Skip to content

fix: pass the session's batch_size to the Iceberg table scan - #102

Merged
gabotechs merged 1 commit into
apache:mainfrom
nikkhiil-hadoop:fix/scan-batch-size
Nov 10, 2026
Merged

gabotechs merged 1 commit into
apache:mainfrom
nikkhiil-hadoop:fix/scan-batch-size

Conversation

@nikkhiil-hadoop

Copy link
Copy Markdown
Contributor

Closes #100.

IcebergDataSource::open didn't pass execution.batch_size to get_batch_stream,
which never called TableScanBuilder::with_batch_size. Scans therefore always read
arrow-rs's default of 1,024-row batches, and SET datafusion.execution.batch_size
had no effect on them. This passes the session's value through, as suggested in
the issue.

Test

crates/datafusion/tests/batch_size.rs sets batch_size = 2000 and checks that the
largest batch from SELECT pickup_date FROM taxi has 2,000 rows. It fails on main
with 1,024. The size is deliberately above 1,024: DataFusion splits batches that are
larger than batch_size after the scan, so a smaller value passes without the fix.
The test also snapshots the plan (CooperativeExec over DataSourceExec), so an
operator that merges batches above the scan would show up as a snapshot change
instead of silently weakening the assertion.

To get at the batches, IcebergTestHarness gains query_batches, which returns
them unformatted; query now delegates to it.

Checks

  • cargo fmt --all -- --check
  • cargo clippy --workspace --locked --all-targets -- -D warnings
  • cargo test --workspace --locked

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 gabotechs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks @nikkhiil-hadoop!

@gabotechs
gabotechs merged commit f2058c4 into apache:main Nov 10, 2026
5 checks passed
@nikkhiil-hadoop
nikkhiil-hadoop deleted the fix/scan-batch-size branch November 10, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IcebergTableScan ignores the session's batch_size

2 participants