Skip to content

GH-470: [Vector] Fix ListViewVector.getElementEndIndex(index) method#1019

Open
axreldable wants to merge 2 commits intoapache:mainfrom
axreldable:gh-470-get-end-index-list-view-1
Open

GH-470: [Vector] Fix ListViewVector.getElementEndIndex(index) method#1019
axreldable wants to merge 2 commits intoapache:mainfrom
axreldable:gh-470-get-end-index-list-view-1

Conversation

@axreldable
Copy link
Contributor

What's Changed

First commit changes logic:

  • The PR fixes a bug in the ListViewVector.getElementEndIndex(index) method .

Before:

public int getElementEndIndex(int index) {
  return sizeBuffer.getInt(index * OFFSET_WIDTH);
}

After:

public int getElementEndIndex(int index) {
  return offsetBuffer.getInt(index * OFFSET_WIDTH) + sizeBuffer.getInt(index * SIZE_WIDTH);
}

Second commit doesn't change logic:

  • Fixes a bug of usage sizeBuffer with OFFSET_WIDTH (hashCode method) and offsetBuffer with SIZE_WIDTH (setSize method). It doesn't introduce real changes in the logic as OFFSET_WIDTH == SIZE_WIDTH == 4

  • Plus small refactoring of ListViewVector to avoid code duplication and similar issues in the future.


It's a bug fix.


Closes #470.

@github-actions

This comment has been minimized.

@axreldable
Copy link
Contributor Author

Please add the bug-fix label.

@lidavidm lidavidm added the bug-fix PRs that fix a big. label Feb 15, 2026
@github-actions github-actions bot added this to the 19.0.0 milestone Feb 15, 2026
…(hashCode) and offsetBuffer with SIZE_WIDTH (setSize) plus refactoring to avoid code duplication in ListViewVector
@axreldable axreldable force-pushed the gh-470-get-end-index-list-view-1 branch from aec2975 to ade73e5 Compare February 16, 2026 19:29
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.

ListViewVector#getElementEndIndex Returns Size not Index

2 participants