Skip to content

Add dictionary_columns to incremental append scan Arrow reads - #4521

Merged
Fokko merged 1 commit into
apache:mainfrom
smaheshwar-pltr:sm/ias-dictionary-columns
Nov 30, 2026
Merged

Fokko merged 1 commit into
apache:mainfrom
smaheshwar-pltr:sm/ias-dictionary-columns

Conversation

@smaheshwar-pltr

Copy link
Copy Markdown
Contributor

Rationale for this change

DataScan.to_arrow() and to_arrow_batch_reader() take dictionary_columns, which reads the given columns dictionary-encoded to save memory on low-cardinality strings. The IncrementalAppendScan versions don't, although both go through the same Arrow helpers. This adds the argument to both, with the same default and docstring as DataScan.

Are these changes tested?

Yes. A test runs an incremental scan over two appends on the in-memory and SQL catalogs, and checks that both methods return only the requested column dictionary-encoded.

Are there any user-facing changes?

IncrementalAppendScan.to_arrow() and to_arrow_batch_reader() accept an optional dictionary_columns argument.

AI Disclosure: This PR was authored by Claude Code (Opus 5.5) but directed and overseen by me.

`DataScan.to_arrow` and `to_arrow_batch_reader` accept `dictionary_columns`,
but the `IncrementalAppendScan` equivalents did not, even though the shared
Arrow helpers already thread the option through. Forward it with the same
signature and docstring as `DataScan`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@smaheshwar-pltr
smaheshwar-pltr marked this pull request as ready for review November 29, 2026 23:22

All rows will be loaded into memory at once.

Args:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(See

Args:
dictionary_columns:
A tuple of column names that PyArrow should read as
dictionary-encoded (``pa.DictionaryArray``). Dictionary
encoding can substantially reduce memory usage for columns
with low-cardinality repeated string values.
Only applies to Parquet files; silently ignored for ORC.
)

@Fokko Fokko 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.

Thanks @smaheshwar-pltr. In hindsight this shouldn't be exposed since it is an PyArrow specific implementation detail, but that ship has sailed 😬

@Fokko
Fokko added this pull request to the merge queue Nov 30, 2026
Merged via the queue into apache:main with commit 79a87ed Nov 30, 2026
20 checks passed
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