Repository navigation
Conversation
comphead
reviewed
Dec 1, 2026
comphead
left a comment
Contributor
There was a problem hiding this comment.
The fix is in the right place. normalized_keys() is called once in this file (the existing (Dictionary, Utf8) arm), and the new guard returns before it with a null Utf8 array and the leaf marked present. The test reuses the existing struct_batch, struct_schema and roundtrip helpers. A SQL file test cannot replace it because Spark does not write an ARROW:schema dictionary hint, so the Rust test is the right level. new_null_array(&dictionary, 3) produces an empty values child (ArrayData::new_null uses new_empty for dictionary values), which is what the test needs. I did not run it. Its only overlap with another open PR is a trivial test-module conflict in schema_adapter.rs with #7781.
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.
Which issue does this PR close?
This isolates the empty dictionary panic reported during review of #7718 for a requested backport to
branch-1.2. It covers the nested conversion introduced by #7106 for #7032.Rationale for this change
A Parquet struct can have a binary dictionary child with null keys and no entries. When reading that child as a string, Comet 1.2.0 calls Arrow's
normalized_keys(), which asserts that the dictionary has at least one entry. The read panics even though all the field values are null.On
main, #7718 already avoids the panic by normalizing keys only when expanding the dictionary overflows the string offsets. An empty dictionary cannot overflow. This PR makes the empty case explicit and adds a regression test that can be backported without the other changes in #7718.What changes are included in this PR?
Return a null string array of the input length when a binary dictionary has no entries. Mark the field present so each parent struct retains its validity. Nonempty dictionaries keep the conversion and overflow handling from #7718.
For the backport, keep the existing dictionary conversion on
branch-1.2and insert the guard beforedictionary.normalized_keys(). The test applies unchanged.How are these changes tested?
nested_all_null_binary_dictionary_reads_as_stringwrites three present structs with a nullDictionary(Int32, Binary)child and reads them back through the Parquet scan with the child requested as a string. It checks that the three structs are present and all three string fields are null. Hosted CI runs the regression.