HIVE-29857: Iceberg: Fix ROW__POSITION on vectorized VARIANT reads - #6743
Open
deniskuzZ wants to merge 2 commits into
Open
HIVE-29857: Iceberg: Fix ROW__POSITION on vectorized VARIANT reads#6743deniskuzZ wants to merge 2 commits into
deniskuzZ wants to merge 2 commits into
Conversation
ROW__POSITION came back as Long.MIN_VALUE for every VARIANT table read
vectorized, and row lineage and positional deletes read the same value.
HiveBatchIterator takes the position of a batch from the record reader, but only
when the reader is a RowPositionAwareVectorizedRecordReader:
if (batch.size != 0 && recordReader instanceof RowPositionAwareVectorizedRecordReader) {
rowOffset = ((RowPositionAwareVectorizedRecordReader) recordReader).getRowNumber();
}
A VARIANT table's reader is wrapped in ParquetVariantRecordReader, which declared
only RecordReader, so the test failed and rowOffset kept the marker that stands
for an unknown position. Let the wrapper carry the interface and answer from the
reader it wraps, and let it fail rather than hand back the marker.
That uncovered a second fault underneath. Variant row group pruning handed the
reader a footer holding only the row groups that survived, and the reader counted
row positions by walking that footer and summing row counts. A position is
absolute within the file, so counting it over a footer that is missing row groups
placed every row group after a pruned one too low - the first row of the second
row group reported position 0 rather than 200. The same footer also fed the scan
statistics, which under reported the rows and bytes a variant scan covers.
The reader now keeps the file's own footer and is told separately which row groups
to read, as ORC's readers are. Parquet records where each row group's first row
sits in the file, so the position is read from the footer rather than counted up,
and stays right whatever subset of row groups a split reads.
VariantParquetFilters.pickRowGroups already returned that decision as a boolean
per row group for the non-vectorized reader; the vectorized path now takes the
same answer instead of a pruned footer, so pruneVariantRowGroups has no caller
left and is removed.
variant_type_row_position.q prunes an early row group and checks that the
surviving rows keep the positions they were written at. Without the first fix the
positions are the unknown marker, without the second they are short by the pruned
row group's row count.
deniskuzZ
force-pushed
the
variant-rowpos-fix
branch
from
August 31, 2026 15:26
68cd15f to
9580356
Compare
deniskuzZ
force-pushed
the
variant-rowpos-fix
branch
from
August 31, 2026 16:14
9580356 to
0c579aa
Compare
deniskuzZ
force-pushed
the
variant-rowpos-fix
branch
from
August 31, 2026 16:16
0c579aa to
ee45098
Compare
|
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.



What changes were proposed in this pull request?
Why are the changes needed?
Fix ROW__POSITION on vectorized VARIANT reads
Does this PR introduce any user-facing change?
How was this patch tested?
variant_type_row_position.q