Repository navigation
Core: Decode dictionary arrays before applying Arrow partition transforms - #4340
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
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
Appending a dictionary-encoded Arrow table to a table partitioned by
bucket,truncate,year,month,dayorhourraised:The partition transforms run on Arrow arrays through
_pyiceberg_transform_wrapper, which forwarded the array as-is. The Arrow kernels behind the transforms have no implementation for dictionary types, so any dictionary-encoded column used in a partition transform failed even though Iceberg has no dictionary type and reads such a column as its value type.The wrapper now decodes dictionary arrays with
dictionary_decode()before calling the transform, per chunk for chunked arrays. The result matches what the same values produce without dictionary encoding, so partitions, and therefore partition pruning, stay the same.Are these changes tested?
Yes.
tests/test_transforms.py::test_pyarrow_transform_decodes_dictionary_arrayscovers bothpa.Arrayandpa.ChunkedArrayand asserts the dictionary-encoded input gives the same buckets as the plain input, including a null.tests/catalog/test_catalog_behaviors.py::test_write_dictionary_encoded_column_with_bucket_partitionappends a dictionary-encoded table to a bucket-partitioned table, checks the rows read back and that both partitions were created. It runs against the memory, sql, and sql_without_rowcount catalogs.Both fail on main and pass with the change.
Full unit suite:
4573 passed, 5 skipped.prek run -apasses.Are there any user-facing changes?
Yes. Appending dictionary-encoded columns to a table with a partition transform now works instead of raising
FeatureUnsupported.Closes #3633