Repository navigation
Core: Decode dictionary columns when concatenating scan batches - #4342
Open
Anurag-S1ngh wants to merge 1 commit into
Open
Anurag-S1ngh wants to merge 1 commit into
Anurag-S1ngh wants to merge 1 commit into
Conversation
Open
2 of 3 tasks
This branch has not been deployed
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.
Rationale for this change
A table can hold files with plain string columns and files with dictionary-encoded string columns, for example after a writer started passing dictionary-encoded Arrow tables.
ArrowScan.to_tableconcatenates one table per batch withpromote_options="permissive", which promotes large types but cannot merge a plain string column with a dictionary-encoded one, so the scan failed with:Batches are now normalized before concatenation. Dictionary-encoded columns that were not requested through
ArrowScan(dictionary_columns=...)are decoded to their value type, so every batch shares one logical schema. Columns that were explicitly requested as dictionary-encoded keep their dictionary type, which the existingdictionary_columnsbehavior and its test rely on.Are these changes tested?
Yes.
tests/catalog/test_catalog_behaviors.py::test_scan_mixed_dictionary_and_plain_string_batchescreates a table, appends a dictionary-encoded file and then a plain file, and asserts the scan succeeds, returns the plain string type, and returns both rows. It runs against the memory, sql, and sql_without_rowcount catalogs and fails on main.The existing
tests/io/test_pyarrow.py::test_dictionary_columns_produces_dict_encoded_outputstill passes, which guards that requested dictionary columns are not decoded.Full unit suite:
4563 passed, 5 skipped.prek run -apasses.Are there any user-facing changes?
Yes. Scanning a table whose files mix dictionary-encoded and plain columns now works instead of raising
ArrowTypeError. Scans that requestdictionary_columnsstill return dictionary-encoded arrays for those columns.Closes #3260