Skip to content

Arrow: Fix valuesRead accumulation in VectorizedDeltaEncodedValuesReader - #17121

Open
ebyhr wants to merge 1 commit into
apache:mainfrom
ebyhr:ebi/parquet-vectorized
Open

Arrow: Fix valuesRead accumulation in VectorizedDeltaEncodedValuesReader#17121
ebyhr wants to merge 1 commit into
apache:mainfrom
ebyhr:ebi/parquet-vectorized

Conversation

@ebyhr

@ebyhr ebyhr commented Jul 7, 2026

Copy link
Copy Markdown
Member

VectorizedDeltaEncodedValuesReader.readValues resets valuesRead to the current batch size on every call (valuesRead = total - remaining) instead of accumulating it (+=). On a multi-batch page read the overflow guard valuesRead + total > totalValueCount sees a stale count and silently allows reads past the logical end of the page.

The bug does not throw - DELTA_BINARY_PACKED mini-blocks are zero-padded to a fixed size, so the reader decodes the padding zeros as valid deltas and emits plausible-looking but wrong values. For example, a page of [10, 20, ..., 100] read in batches of 6 and 4, then read once more, returns 110 - the next extrapolated delta step - with no error.

@github-actions github-actions Bot added the arrow label Jul 7, 2026
assertThat(batch2).containsExactly(70, 80, 90, 100);

assertThat(reader.totalValueCount()).isEqualTo(10);
assertThatThrownBy(() -> reader.readIntegers(1, 0))

@ebyhr ebyhr Jul 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reader.readIntegers(1, 0) returns [110] without this PR fix.

@ebyhr
ebyhr force-pushed the ebi/parquet-vectorized branch from a7a057c to ea5dd96 Compare July 10, 2026 10:56
@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Aug 13, 2026
@ebyhr
ebyhr force-pushed the ebi/parquet-vectorized branch from ea5dd96 to b3598bc Compare August 13, 2026 00:26
@github-actions github-actions Bot removed the stale label Aug 14, 2026
@ebyhr
ebyhr force-pushed the ebi/parquet-vectorized branch from b3598bc to a77c349 Compare August 20, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants