Skip to content

GH-812: Fix appending to an empty UnionVector - #1292

Open
hutiefang76 wants to merge 1 commit into
apache:mainfrom
hutiefang76:frank/arrow-java-812-empty-union
Open

GH-812: Fix appending to an empty UnionVector#1292
hutiefang76 wants to merge 1 commit into
apache:mainfrom
hutiefang76:frank/arrow-java-812-empty-union

Conversation

@hutiefang76

Copy link
Copy Markdown

What's Changed

Appending to a newly created UnionVector repeatedly reallocates its type buffer until allocation fails: its value capacity remains zero until it has child vectors. Check the type buffer capacity at this stage, since the existing append loop creates and expands the child vectors afterward.

The regression appends two floats to an empty union with a bounded allocator. It fails before the change with an allocation error and passes afterward. All 32 TestVectorAppender tests pass with both the Netty and Unsafe allocators on JDK 21. Checkstyle and Spotless also pass.

Closes #812.

Validation (JDK 21):

mvn -B -pl vector -am test -Dtest=TestVectorAppender -Dsurefire.failIfNoSpecifiedTests=false
mvn -B -pl vector spotless:check

Developed with AI assistance; the regression was verified to fail before the fix and pass afterward.

@github-actions

Copy link
Copy Markdown

Thank you for opening a pull request!

Please label the PR with one or more of:

  • bug-fix
  • chore
  • dependencies
  • documentation
  • enhancement

Also, add the 'breaking-change' label if appropriate.

See CONTRIBUTING.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VectorAppender fails with OversizedAllocationException when appending to empty UnionVector

1 participant