Arrow: Fix int96 timestamp offset in arrow dictionary decode#16435
Open
sungwy wants to merge 1 commit into
Open
Arrow: Fix int96 timestamp offset in arrow dictionary decode#16435sungwy wants to merge 1 commit into
sungwy wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect INT96 timestamp decoding for Parquet dictionary-encoded packed data in Iceberg’s Arrow vectorized reader by writing to Arrow buffers using byte offsets (instead of value indices), preventing buffer corruption and wrong timestamps.
Changes:
- Correct
TimestampInt96Reader.nextDictEncodedVal(PACKED mode) to use(long) idx * typeWidthwhen callingsetLong. - Add a unit test that reproduces the corruption scenario and verifies correct decoded timestamps across multiple rows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedParquetDefinitionLevelReader.java |
Fixes packed dictionary INT96 decode to write to Arrow buffers using byte offsets, matching other readers and preventing data corruption. |
arrow/src/test/java/org/apache/iceberg/arrow/vectorized/parquet/TestVectorizedParquetDefinitionLevelReader.java |
Adds a regression test ensuring packed dictionary INT96 decoding writes correct per-row values without overwriting adjacent entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Issue: #13485
This PR fixes the packed dictionary INT96 timestamp decode path in the
VectorizedParquetDefinitionLevelReaderto write using byte offsets rather than row indexes.The unit test constructs a dictionary with expected values and verifies that the decoded Arrow buffer contains the expected timestamp values, and verifies that writing multiple rows of values did not corrupt the data as a result of the values being written into the wrong offsets.
The fix is the same as the earlier proposed change discussed in #13486 , and mirrors the offset handling used by other readers in the same class:
iceberg/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedParquetDefinitionLevelReader.java
Line 302 in 8e7ab3c
Disclosure: