Repository navigation
feat: add pruned Iceberg planning and file-affinity routing - #30
Draft
alexanderbianchi wants to merge 8 commits into
Draft
alexanderbianchi wants to merge 8 commits into
alexanderbianchi wants to merge 8 commits into
Conversation
Aggregate complete projected column sizes from surviving Iceberg manifest entries when column statistics are enabled. Preserve unknown metrics and keep scan task sizing on planned or snapshot file bytes. Expose an opt-in ColumnByteStatisticsProvider to retain group-key and inner-join byte estimates without replacing cardinality models. Document explicit registry setup and the compressed-byte and metadata-IO limitations. Cover pruning, missing and nested metrics, scan sizing, derived-key build selection, and local/distributed result correctness.
Port datafusion-contrib#778 at 494bd57 to the DataDog Iceberg fork PR.
alexanderbianchi
force-pushed
the
alex.bianchi/iceberg-pruned-file-planning
branch
from
October 16, 2026 22:36
fe65b08 to
5cb9df7
Compare
alexanderbianchi
changed the base branch from
main-upstream-dd-2026-09-24
to
main-upstream-dd-13-08-2026
October 16, 2026 22:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plan pruned Iceberg file work before physical optimization, then optionally balance whole-file work across tasks and route those tasks toward stable data homes.
Base:
main-upstream-dd-13-08-2026(includes upstream merged dynamic filtering, including datafusion-contrib#639). The fork's defaultmainis not the appropriate integration base.Pruning-aware planning
TableProvider::scan(), when predicates and projection are available.FileScanTasks in query-localPlannedFiles, shared across plan clones and reused during execution.planned_files/planned_bytes. Filtered/deleted row counts remain inexact; an empty file plan reports exact zero rows.iceberg.planning_max_files(default 100,000).iceberg.plan_files=falseretains execution-time discovery.Optional whole-file balancing and affinity routing
greedy_work_unit_assignment()in DFD: largest-first placement onto the least-loaded task, with deterministic ties and exactly-once input-index coverage. It does not split work or choose workers.iceberg.greedy_file_assignment=trueuses candidate-file bytes for that allocator. Stable file path/range ordering avoids manifest-enumeration tie instability. Assignments are retained per scan/task count, with memory reservations. A separate scoped reservation covers temporary order/cost arrays, allocator ordering/load-heap storage and vector-growth headroom; it is released after construction.WorkUnitFeedProvider::task_affinity()hook.iceberg.file_task_affinity=truesupplies this task's assigned immutable data-file paths and byte weights, using the same assignment as delivery.RouteTaskEvent::work_unit_affinity()without adding required fields to that event or changing the worker protocol.AffinityRouteTaskHandler: each distinct key elects a worker by rendezvous hashing; the whole task prefers the worker owning the greatest total hinted weight. Repeated keys count once using their maximum weight. Query IDs, task IDs and resolver ordering do not influence file homes. Equal affinity scores use a separate hash of the canonical file-key set and worker URL, rather than systematically preferring low worker URLs.rank_workers()while applying their own admission policy.Both Iceberg routing options default to false and require
iceberg.plan_files=true. Enable them on the coordinating session and registerAffinityRouteTaskHandler; the README shows the configuration. Neither the connector nor DFD depends on a cache implementation. Use stable worker URLs identifying individual cache owners, not a load-balanced service URL.The reader, serialized work-unit fields and codec order are unchanged. No iceberg-rust dependency change or protocol bump is included. UNION branch grouping is unchanged.
Validation
Both review regressions were demonstrated failing before the fixes and passing afterward: a 20,000-task equal-weight two-file ranking test across ten workers, and a constrained-pool test that completes file discovery, rejects insufficient assignment scratch headroom, then verifies retry, scratch release and cached-assignment reuse. The ranking test is not a distributed-query benchmark.
Routing metric tests cover preferred placement, same-worker retries, failover, exhausted retries, terminal/resolver errors, deferred routing, duplicate/zero-weight hints and byte-total saturation. The Iceberg integration test verifies feed-delivery and reader metrics coexist on scan nodes.
Routing integration tests use the fixture and in-memory worker transport: they verify requested worker identities and results, not separate physical caches.
Limits / deployment validation still required
Documentation: The life of an iceberg file, Iceberg README, and work-feed/worker-routing guides.