Skip to content

feat: configure Iceberg Arrow reader options per query - #142

Open
alexanderbianchi wants to merge 3 commits into
apache:mainfrom
alexanderbianchi:codex/query-reader-options
Open

alexanderbianchi wants to merge 3 commits into
apache:mainfrom
alexanderbianchi:codex/query-reader-options

Conversation

@alexanderbianchi

@alexanderbianchi alexanderbianchi commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #141 for the upstream reader options API. This carries forward the concurrency and pruning settings from #126.

Rust callers can pass the upstream iceberg::arrow::ArrowReaderOptions directly when building a config for a query:

let reader = ArrowReaderOptions::builder().with_batch_size(2048).build();
let query_config = session_config.clone().with_extension(Arc::new(reader));

Both Iceberg table providers use that complete value when planning the scan. Fields the caller leaves unset take Iceberg defaults, including host parallelism for unset file concurrency. An explicit IcebergDataSourceBuilder::with_reader still takes precedence.

Without a typed override, the reader uses the session settings below. SQL users can register IcebergDataFusionConfig and run, for example, SET iceberg.execution.data_file_concurrency_limit = 4 before planning a scan.

Config prefix Reader settings
datafusion.execution batch_size
datafusion.execution.parquet pruning, enable_page_index, bloom_filter_on_read, metadata_size_hint
iceberg.execution data_file_concurrency_limit (default one per output partition)
iceberg.execution.parquet range_coalesce_bytes, range_fetch_concurrency, preload_column_index, preload_offset_index, preload_page_index

This enables Bloom-filter reads by default in the session-settings path, following DataFusion. Iceberg accepts the stored preload_page_index flag but derives its effective value per file from predicates and deletes.

Two scan tests cover the integration. A typed batch size of 137 overrides the session setting of 2,000. Enabling row-group pruning returns the same rows with fewer reads.

Verified locally with cargo fmt --all -- --check, cargo clippy --workspace --locked --all-targets -- -D warnings, and cargo test --workspace --locked.

@alexanderbianchi
alexanderbianchi marked this pull request as draft November 24, 2026 14:04
@alexanderbianchi
alexanderbianchi marked this pull request as ready for review November 24, 2026 14:16
@alexanderbianchi
alexanderbianchi force-pushed the codex/query-reader-options branch from 59d67ca to d4a11e8 Compare November 24, 2026 16:19
@NoahKusaba

NoahKusaba commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

One thing about the default of data_file_concurrency_limit = 1: a lazy scan has a single output partition, so with this default it reads every data file one after another. That has been true since #113 moved the limit into IcebergDataSource::builder; before that, the source called TableScan::to_arrow, which reads up to one file per CPU at once.

I checked this on main (9381791) with a storage wrapper that adds 20 ms to each data-file read and records how many files have reads in flight at once, over the 7-file taxi table:

Scan Most files read at once
SELECT * FROM taxi through IcebergStaticTableProvider (lazy, default reader) 1
Same lazy scan, with with_reader and the limit unset 7
TableScan::to_arrow (what the source called before #113) 7

The limit of one makes sense for eager scans spread over target_partitions, but for the default lazy mode it makes object-store reads serial. Could the default stay unset (Iceberg's per-CPU default) when the scan has one partition, or at least for lazy scans until #84 lands? Making it an Option<usize> in the config would also let users ask for Iceberg's default explicitly.

(I ran into this in Ballista, where every Iceberg scan is lazy, and thinking about passing a reader the limit unset to get around this.)

NoahKusaba added a commit to NoahKusaba/datafusion-ballista that referenced this pull request Nov 25, 2026
iceberg-datafusion's default reader reads one data file at a time per
output partition, but a lazy scan has one partition, so Ballista's Iceberg
scans read their files one after another. Before the upgrade they read up
to one file per CPU at once, through TableScan::to_arrow.

Build the reader in one helper shared by PinnedTable::scan and the
physical codec: it keeps batch size and page index from the session and
leaves the concurrency limit to Iceberg. Reported upstream on
apache/datafusion-iceberg#142.
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.

2 participants