Repository navigation
fix(datafusion): decode IcebergTableScan batches at the session batch_size - #58
Merged
Merged
Conversation
…_size IcebergTableScan::execute ignored its TaskContext, so the scan decoded with the Parquet reader's 1024-row default rather than the session's batch_size (8192 by default). Every downstream operator then paid its per-batch cost 8x as often.
There was a problem hiding this comment.
🟢 Approved
The focused configuration propagation is complete and consistent across both scan modes.
0 open findings
What changed in this PR
Aligns Iceberg scan decoding with DataFusion’s session batch size, reducing downstream per-batch overhead.
Changes:
- Reads
batch_sizefrom the executionTaskContext. - Propagates it to
TableScanBuilder.
| File | Description |
|---|---|
crates/integrations/datafusion/src/physical_plan/scan.rs |
Applies the session batch size when building scan streams. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
sgrebnov
approved these changes
Oct 12, 2026
…e's context parameter
Copilot
AI
dismissed their stale review, a newer Copilot review was requested
October 12, 2026 20:13
bjchambers
added a commit
to spiceai/spiceai
that referenced
this pull request
Oct 12, 2026
Move all six iceberg-rust pins to 1707b349, the merge of spiceai/iceberg-rust#58 into spiceai-0.11.0-df-55, and drop the TEMPORARY marker from the fork-ledger row. Cargo.lock changes only the iceberg-rust package sources. Pass RecordBatch::num_rows directly in the batch-size guard, which the pedantic clippy pass over tests requires. Refs #15064
This was referenced Oct 12, 2026
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.
What
IcebergTableScan::executeignored itsTaskContext, so every scan decoded batches at the Parquet reader's 1024-row default rather than the session'sbatch_size(8192 by default). This passescontext.session_config().batch_size()throughbuild_record_batch_streamandbuild_table_scantoTableScanBuilder::with_batch_size.This is the same layer DataFusion's own file scans read it from:
FileScanConfigtakes the batch size from the task's session config when the plan doesn't set one. Reading it atexecutealso means the distributed codec needs no change, because each executor supplies its ownTaskContext.Why
Every operator downstream of the scan pays its per-batch cost per batch, so 1024-row batches cost 8x the batches. On a first load of a 40.2M-row Iceberg table into a Spice acceleration, this change alone took the load from 19.1–19.5 s to 15.4–16.2 s (interleaved A/B, 3 repetitions each). Refs spiceai/spiceai#15064.
Tests
The guard for this patch lives in spiceai/spiceai, per its fork-patch ledger, so it survives a branch re-cut. It asserts a provider scan emits batches of the session
batch_size, and fails at 1024 rows on the current pin. It lands in the same pull request that moves the pin.The DataFusion integration has since moved upstream to apache/datafusion-iceberg, which has the same
_contextgap; this is worth upstreaming there separately.