Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] MapVector.splitAndTransfer throws for empty vector #44626

Closed
maksimyego-db opened this issue Nov 3, 2024 · 2 comments
Closed

[Java] MapVector.splitAndTransfer throws for empty vector #44626

maksimyego-db opened this issue Nov 3, 2024 · 2 comments

Comments

@maksimyego-db
Copy link

maksimyego-db commented Nov 3, 2024

Describe the bug, including details regarding any error messages, version, and platform.

As reported in #30866:

splitAndTransfer on vectors throws if the vector is completely empty and the offset buffer is empty.

This is still the case for MapVector in release 18.0.0. We encounter this error with some regularity for a non-empty ListVector with an empty child MapVector:

java.lang.IndexOutOfBoundsException: index: 0, length: 4 (expected: range(0, 0))
	at org.apache.arrow.memory.ArrowBuf.checkIndexD(ArrowBuf.java:299) 
	at org.apache.arrow.memory.ArrowBuf.chk(ArrowBuf.java:285) 
	at org.apache.arrow.memory.ArrowBuf.getInt(ArrowBuf.java:405) 
	at org.apache.arrow.vector.complex.MapVector$TransferImpl.splitAndTransfer(MapVector.java:214) 
	at org.apache.arrow.vector.complex.ListVector$TransferImpl.splitAndTransfer(ListVector.java:570) 

Here ListVector calls dataTransferPair.splitAndTransfer(/* startPoint =*/ 0, /* sliceLength =*/ 0) on a MapVector with offsetBuffer.capacity() of 0.

The fix in #44627 can be identical to that for BaseLargeVariableWidthVector, BaseVariableWidthVector and ListVector in #41066

Component(s)

Java

@myegorov
Copy link
Contributor

myegorov commented Nov 3, 2024

take

myegorov pushed a commit to myegorov/arrow that referenced this issue Nov 6, 2024
lidavidm pushed a commit that referenced this issue Nov 8, 2024
)

### Rationale for this change

Empty MapVector.splitAndTransfer throws `java.lang.IndexOutOfBoundsException`. Details in  #44626

### What changes are included in this PR?

Fixed for MapVector as for other vector types in #41066

### Are these changes tested?

Added unit test mimicking the scenario we've observed where MapVector's offset buffer capacity is 0.
* GitHub Issue: #44626

Authored-by: Maksim Yegorov <[email protected]>
Signed-off-by: David Li <[email protected]>
@lidavidm
Copy link
Member

lidavidm commented Nov 8, 2024

Issue resolved by pull request 44627
#44627

@lidavidm lidavidm added this to the 19.0.0 milestone Nov 8, 2024
@lidavidm lidavidm closed this as completed Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants