Repository navigation
feat: plan eager Iceberg scans with source-owned files - #803
alexanderbianchi wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Hm this feels like it shouldn't be in the harness, should be like a trait on the data source maybe. ideally without messing up the code.
| proto_converter, | ||
| )? | ||
| .ok_or_else(|| proto_error("IcebergDataSource is missing its partitioning"))?; | ||
| let input = match (proto.feed, proto.assigned_files) { |
There was a problem hiding this comment.
The fact we need this complex decoding is a red flag.
There was a problem hiding this comment.
Maybe we could have 2 different protos at the top level with their own path to the same data source and share common componends.
| /// | ||
| /// This distributed mechanism is transparent to this [DataSource]. | ||
| /// Reads Iceberg file tasks through one reader. Eager scans own an immutable | ||
| /// assignment exposed by [`Self::planned_partition_tasks`]; lazy scans use a work-unit feed. |
There was a problem hiding this comment.
only used in tests? should be marked integration maybe? comment should specify that.
| use crate::{IcebergConfig, IcebergDataSource}; | ||
|
|
||
| /// Materialize eager assignments after the planner has chosen the final task count. | ||
| pub(crate) fn iceberg_scale_up( |
There was a problem hiding this comment.
Matches the file scan config path? we should explicitlymention that in the comment.
| /// Returns `None` for lazy scans and `Some` with an empty iterator for empty | ||
| /// eager scans. This borrows the execution assignment without I/O or cloning | ||
| /// descriptors; iteration order does not promise row ordering. | ||
| pub fn planned_files(&self) -> Option<impl Iterator<Item = &FileScanTask>> { |
There was a problem hiding this comment.
also only used in tests?
| for task in 0..task_count { | ||
| loads.push(Reverse((0_u128, 0_usize, task))); | ||
| if task % 256 == 0 { | ||
| tokio::task::yield_now().await; |
There was a problem hiding this comment.
why removing these?
| @@ -122,10 +123,11 @@ fn set_iceberg_integration(state: &mut SessionState, options: IcebergIntegration | |||
| )), | |||
| ); | |||
| state.set_distributed_desired_task_count_handler(iceberg_desired_task_count); | |||
There was a problem hiding this comment.
Hod does this differ from below?
a07bff5 to
093942f
Compare
Eager files belong to the scan
This draft combines #773's eager file planning with source-owned execution input, directly against
main. It explores landing the intended ownership model first, without introducing eager feeds and replacing them in a later PR. Lazy planning remains the default.AssignedIcebergDataSourceholds shared descriptors and its partition groups directly. The source is the authority for routing, serialization, and execution.PlannedFilesonly owns descriptors and their memory reservation; there is no separateAssignedFilesobject, assignment-policy enum, or routing metadata copy.IcebergDataSourceretains the lazy feed lifecycle. Both sources share scan settings and reader execution. The planning boundary selects the source; eager execution does not pass through a work-unit feed.Assignment and routing
Like DFD's
FileScanConfigpath, the scale-up handler produces task-local source variants in aDistributedLeafExecbefore routing. Files visit tasks first, then local partitions. Coordinator variants share descriptor storage; each worker plan carries only that task's assigned descriptors.The existing
RouteTaskEvent::task_specialized_planis sufficient. Downcast the source toAssignedIcebergDataSourceand borrowplanned_files()orplanned_partition_tasks(partition)before choosing a worker. Iceberg continues using its own reader andFileIO, without placeholder storage URLs.Scope and tradeoffs
docs/upgrade/5.0.0.md.This follows the source-owned planning direction explored in datafusion-iceberg#67 and Gabriel's data-source ownership suggestion on #797. It is an alternative foundation to #773 and the experiments in #797/#799/#801; those PRs remain unchanged.
Validation
Integration coverage includes eager/lazy result parity, task-first distribution, routing after pruning, isolated UNION branches, descriptor round trips, repeated execution, and query-memory limits. Codec tests reject missing variants and malformed groups/descriptors.
Passed: full Iceberg integration suite (58 tests and one doctest), all-target Clippy with warnings denied, formatting, and documentation build.