Repository navigation
GH-2870: Report compressed dictionary page sizes in the CLI - #3798
Merged
Merged
Conversation
Signed-off-by: 1fanwang <1fannnw@gmail.com>
divjotarora
suggested changes
Sep 18, 2026
divjotarora
left a comment
Contributor
There was a problem hiding this comment.
Seems reasonable, but one possible edge case
| // TODO: the compressed size of a dictionary page is lost in Parquet | ||
| dict.getUncompressedSize(); | ||
| long totalSize = dict.getCompressedSize(); | ||
| long totalSize = getPageCompressedSize(); |
Contributor
There was a problem hiding this comment.
getPageCompressedSize calls columnChunk.hasDictionaryPage() to determine the page offset. This function does:
public boolean hasDictionaryPage() {
EncodingStats stats = getEncodingStats();
if (stats != null) {
// ensure there is a dictionary page and that it is used to encode data pages
return stats.hasDictionaryPages() && stats.hasDictionaryEncodedPages();
}
Set<Encoding> encodings = getEncodings();
return (encodings.contains(PLAIN_DICTIONARY) || encodings.contains(RLE_DICTIONARY));
}
In an edge case where a writer emits a dictionary page followed by no PLAIN_DICTIONARY or RLE_DICTIONARY data pages, we would get wrong results because hasDictionaryPage() returns false.
Realistically, writers wouldn't do this, but I didn't find any wording in the spec explicitly disallowing it. The TestParquetFileWriter code in this repo seems to do exactly this.
Member
There was a problem hiding this comment.
At least this change is not worse than before. :)
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Dictionary presence and dictionary use are separate metadata facts. This regression keeps the CLI anchored to the physical chunk start for valid files with an unused dictionary. Signed-off-by: 1fanwang <1fannnw@gmail.com>
…ary-page-size Signed-off-by: 1fanwang <1fannnw@gmail.com>
wgtmac
approved these changes
Oct 11, 2026
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
parquet pages reports decoded dictionary sizes instead of the bytes stored in compressed files. It can also fail on a valid column chunk whose dictionary page is present but unused by its data pages.
What changes are included in this PR?
The CLI reads compressed sizes from each stored page header and starts at the column chunk's physical first page.
Closes #2870.
Are these changes tested?
Testing Done
I built the baseline and fixed runtime jars with JDK 17.0.5 and Thrift 0.24.0.
Compressed dictionary before:
Compressed dictionary after:
Save the reproducer source below as WriteUnusedDictionary.java, then create the unused-dictionary fixture.
Unused dictionary before:
Unused dictionary after:
Reproducer source: WriteUnusedDictionary.java
Are there any user-facing changes?
Dictionary summaries report stored compressed bytes, including when no data page uses the dictionary.