NoahKusaba opened a new pull request, #158:
URL: https://github.com/apache/datafusion-iceberg/pull/158

   ## Which issue does this PR close?
   
   Part of #23. A draft, to agree on the approach.
   
   ## Rationale for this change
   
   Distributed engines send plan stages to other processes through a 
`PhysicalExtensionCodec`. Each engine now writes its own codec for Iceberg 
scans. Ballista's sends the table and has each executor list the files again, 
so it refuses scans with more than one partition, and every Iceberg scan runs 
as one task.
   
   An eager scan already lists its files once, while planning, and gives each 
partition a fixed group of files. Sending those groups lets any process run any 
partition, without catalog access or file listing on the executors.
   
   ## What changes are included in this PR?
   
   - A `proto` feature, adding `datafusion-proto`, `prost` and `rmp-serde`.
   - `codec::IcebergPhysicalCodec` encodes a `DataSourceExec` over an 
`IcebergDataSource` whose tasks come from an `EagerFileScanTaskProvider`: the 
schema, fetch, `FileIO` and file groups. File tasks use iceberg-rust's serde 
(MessagePack), inside prost messages. Other nodes fail to encode, so engines 
compose it with their own codec.
   - A lazy scan fails to encode, with an error naming 
`iceberg.execution.eager_file_planning`. It lists its files when it runs, and 
its partitions share that listing, so a process running one partition would 
read every file.
   - `FileIOCodec` replaces how storage access is encoded, e.g. to keep 
credentials out of plans. `FileScanTaskProviderCodec` encodes other task 
providers, e.g. one that receives its files from a coordinator.
   - CI runs clippy and tests with `--all-features`.
   
   ## Are these tested?
   
   Yes, in `tests/physical_codec.rs`: an eager plan decoded in a session 
without the table, checking the decoded plan, its file groups and its results; 
the error for a lazy scan; a `FileIOCodec` required to decode; and a custom 
provider.
   
   Outside this repo, the codec ran an aggregate over a 7-file table on a 
datafusion-distributed in-memory cluster (3 tasks, each reading its own files) 
and on standalone Ballista (a scan stage of 3 tasks), with correct results on 
both.
   
   ## Are there any user-facing changes?
   
   New API behind the `proto` feature; nothing changes without it.
   
   Known limitations:
   
   - Plans grow by about 1 KB per planned file, since each `FileScanTask` 
carries its own schema and partition spec. Engines should send each task only 
its own groups, as datafusion-distributed's leaf variants and Ballista's 
`PartitionSliceableResolver` allow.
   - An encoded scan holds the table's storage credentials, unless a 
`FileIOCodec` leaves them out, and for an encrypted table the keys of the files 
it reads.
   - A decoded scan reads with the receiving session's batch size and page 
index settings. Other reader settings aren't encoded.
   - Writes, commits and metadata tables aren't encoded yet.
   
   Open questions: the feature's name (`proto`, as in DataFusion), and whether 
`FileScanTaskProviderCodec` should wait until an engine needs it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to