Repository navigation
fix: pass the session's batch_size to the Iceberg table scan - #102
Merged
Merged
Conversation
IcebergDataSource::open did not pass execution.batch_size to get_batch_stream, which never called TableScanBuilder::with_batch_size, so scans always read arrow-rs's default 1024-row batches. Add a regression test that sets batch_size above 1024 (smaller sizes pass without the fix because DataFusion splits oversized batches after the scan), and an IcebergTestHarness::query_batches helper that returns unformatted batches. Closes apache#100
gabotechs
approved these changes
Nov 10, 2026
gabotechs
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Thanks @nikkhiil-hadoop!
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.
Closes #100.
IcebergDataSource::opendidn't passexecution.batch_sizetoget_batch_stream,which never called
TableScanBuilder::with_batch_size. Scans therefore always readarrow-rs's default of 1,024-row batches, and
SET datafusion.execution.batch_sizehad no effect on them. This passes the session's value through, as suggested in
the issue.
Test
crates/datafusion/tests/batch_size.rssetsbatch_size = 2000and checks that thelargest batch from
SELECT pickup_date FROM taxihas 2,000 rows. It fails onmainwith 1,024. The size is deliberately above 1,024: DataFusion splits batches that are
larger than
batch_sizeafter the scan, so a smaller value passes without the fix.The test also snapshots the plan (
CooperativeExecoverDataSourceExec), so anoperator that merges batches above the scan would show up as a snapshot change
instead of silently weakening the assertion.
To get at the batches,
IcebergTestHarnessgainsquery_batches, which returnsthem unformatted;
querynow delegates to it.Checks
cargo fmt --all -- --checkcargo clippy --workspace --locked --all-targets -- -D warningscargo test --workspace --locked