Hi David,

Thanks for writing up AIP-132, it reads really well. +1, and I'd be glad to
co-author it, mainly on phase 1 and the shared behaviour suite (my earlier
reply ended up in a separate thread, sorry about that).

Since Amogh's point was that FileTransferOperator only copies one object, I
gave phase 1 a try on the real APIs. It's a small subclass of common.io
FileTransferOperator on ObjectStoragePath (Airflow 3.4) that copies a whole
prefix: it lists once, skips folder markers from that same listing, can
skip existing keys, and returns the copied keys. Within one store it uses
ObjectStoragePath.copy, across stores it streams in chunks, and a single
file behaves exactly as today. It passes on local and S3/GCS/Azure
emulators; deferrable mode, OpenLineage and real cloud accounts are still
to do. Code and a short write-up against the AIP's open items:
https://github.com/aoelvp94/airflow-generic-transfer-contract-demo/pull/12

A few thoughts on the open questions, happy to be argued out of any of them:
- Folder markers: classify them from the one listing, so no backend needs
an extra call per key.
- Native fast path: start with same-store copy, then let a hook optionally
say "I can do this natively".
- Pages: Arrow batches for tabular sources, dicts for REST, sized by the
source, so memory follows the batch rather than the dataset.

On that last one, two data points (one machine, small n):
- Streaming Arrow batches end to end keeps peak memory at ~95 MB for 1M
rows, vs ~344 MB when converting to rows first, and it stays flat at 4x the
rows.
- Postgres -> S3, 1M rows: SqlToS3Operator took 14 s and peaked at ~1.35
GiB; a streaming @task did it in 5.3 s at ~234 MiB, same output (
https://github.com/aoelvp94/airflow-transfer-bench).

Not a knock on the operator, it has to cover every case. But I've run
transfers in pods, where peak memory decides the pod size, so having the
streaming in the hook once instead of in each operator matters a lot to me.

On the regression concern: in an earlier prototype, one generic operator
matched the existing ones on 34 of 35 checks across the 9 S3/GCS/Azure
pairs, and the one miss was a real bug in S3ToAzureBlobStorageOperator (
https://github.com/apache/airflow/issues/76880, fix in
https://github.com/apache/airflow/pull/76971). So I see a shared behaviour
suite as the safety net, and I'm happy to start it.

Thanks,
Aldo

Reply via email to