Repository navigation
Parquet: list the dictionary page first in page_encoding_stats - #11682
Merged
Merged
Conversation
Since the page-spilling writer (apache#10020), ArrowWriter receives the dictionary page after the data pages, so its encoding_stats entry was appended last. The page itself is still written first in the file. Arrow C++ expects the dictionary entry first to detect fully dictionary encoded chunks, so insert it at the front to match the file layout. Closes apache#11659 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…coding-stats-dict-first # Conflicts: # parquet/src/arrow/arrow_writer/mod.rs
adriangb
marked this pull request as ready for review
October 18, 2026 14:18
Contributor
Author
4 of 5 tasks
Jefffrey
approved these changes
Oct 18, 2026
alamb
pushed a commit
that referenced
this pull request
Oct 19, 2026
…ding_stats (#11699) - Backport #11682 - For inclusion in #11664 Cherry-pick of 33d338d Co-authored-by: Adrian Garcia Badaracco <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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?
Rationale for this change
Since 59.0.0,
ArrowWriterwrites the dictionary page'sencoding_statsentry after the data page entries. The file layout did not change: the dictionary page is still written first. Arrow C++ (IsColumnChunkFullyDictionaryEncoded) requiresencoding_stats[0]to be the dictionary page. With the 59.x order, Arrow C++ does not see any parquet-rs column chunk as fully dictionary encoded, so it cannot use its dictionary fast path.encoding_stats(file order)DATA_PAGE RLE_DICTIONARY,DICTIONARY_PAGE PLAINDICTIONARY_PAGE PLAIN,DATA_PAGE RLE_DICTIONARYThe new order was not a design goal of #10020. It was a side effect: the deferred-ordering page writer gets the dictionary page last, and the stats were recorded in the order the pages were produced. Review accepted this because the spec defines the list as a set (#10051 was closed for that reason). But a known reader depends on the order, and restoring it changes only metadata, so the change has no memory or throughput cost.
What changes are included in this PR?
GenericColumnWriter::write_dictionary_pagenow inserts the dictionary entry at the front ofencoding_statsinstead of appending it. The dictionary page is always laid out first, on both the deferred (Arrow) path and theSerializedFileWriterpath, so the stats now follow file order. On the non-deferred path the list is still empty when the dictionary is written, so its output does not change. When the writer falls back from dictionary to plain encoding, the result isDICTIONARY, RLE_DICTIONARY data, PLAIN data, which also matches the file layout.Are these changes tested?
Yes. The new
dictionary_page_encoding_stats_lists_dictionary_firsttest (adapted from #10051) checks thatstats[0]is the dictionary page. It fails onmainand passes with this change. The existing column writer and arrow writer tests pass.Are there any user-facing changes?
Only the order of
page_encoding_statsin files written byArrowWriter. It goes back to the order used before 59.0.0.🤖 Generated with Claude Code