Repository navigation
Arrow: Fix int96 timestamp offset in arrow dictionary decode - #16435
Conversation
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.
| .order(ByteOrder.LITTLE_ENDIAN); | ||
| long timestampInt96 = ParquetUtil.extractTimestampInt96(buffer); | ||
| vector.getDataBuffer().setLong(idx, timestampInt96); | ||
| vector.getDataBuffer().setLong((long) idx * typeWidth, timestampInt96); |
|
Thanks for the review @nastra - I'll leave it open for a few more days for additional review and merge |
|
@sungwy Please double check the commit message has the module prefix like the PR title when merging. |
|
LGTM! #16459 called out both |
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: