Skip to content

GH-1194: Preserve empty list offset buffers - #1229

Open
prashanthbdremio wants to merge 1 commit into
apache:mainfrom
prashanthbdremio:apache-empty-list-offset
Open

GH-1194: Preserve empty list offset buffers#1229
prashanthbdremio wants to merge 1 commit into
apache:mainfrom
prashanthbdremio:apache-empty-list-offset

Conversation

@prashanthbdremio

Copy link
Copy Markdown

What's Changed

Preserve the required one-entry offset buffer for empty ListVector and LargeListVector instances when setting value count and when splitting/transferring zero values. This keeps empty list vectors aligned with the Arrow offset-buffer invariant and avoids exposing buffers whose writer index exceeds capacity.

Adds regression coverage for allocated, unallocated, split-and-transfer, and nested empty list vectors.

Closes #1194.

Tests:

  • mvn -pl vector -am -P=-error-prone -Dmaven.gitcommitid.skip=true -Dsurefire.failIfNoSpecifiedTests=false -Dtest=TestSplitAndTransfer,TestListVector,TestLargeListVector test
  • mvn -P=-error-prone -Dmaven.gitcommitid.skip=true test

@github-actions

This comment has been minimized.

@prashanthbdremio

Copy link
Copy Markdown
Author

Could a maintainer please add the bug-fix label? This PR fixes GH-1194 and does not require the breaking-change label.

@prashanthbdremio

Copy link
Copy Markdown
Author

could you please take a look at it? thanks!
cc: @Yicong-Huang, @lriggs, @akravchukdremio, selva@apache.org

ArrowBuf oldOffsetBuffer = offsetBuffer;
offsetBuffer = allocateOffsetBuffer(requiredCapacity);
offsetBuffer.setBytes(
0, oldOffsetBuffer, 0, Math.min(oldOffsetBuffer.capacity(), requiredCapacity));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If requiredCapacity exceeds oldOffsetBuffer.capacity(), the remaining offset entries cannot be left uninitialized or zeroed — per the Arrow spec the offset buffer must be monotonically non-decreasing, so unfilled entries must be set to the last copied offset value to represent empty lists at those positions.

@lidavidm lidavidm added the bug-fix PRs that fix a big. label Aug 3, 2026
@github-actions github-actions Bot added this to the 20.0.0 milestone Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty ListVector and LargeListVector can expose offset buffers with writerIndex greater than capacity

3 participants