-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] VectorSchemaRoot.slice() throws for NullVector #44344
Comments
This predates my involvement to Arrow, but I think throw is the right way to go. Because we are requesting an attribute which is defined as something we should not support for a NullVector. cc @lidavidm |
Not to lose sight of the original issue: We should be able to slice a VectorSchemaRoot containing Another alternative is to case match on NullVector in https://github.com/apache/arrow/blob/release-17.0.0-rc2/java/vector/src/main/java/org/apache/arrow/vector/VectorSchemaRoot.java#L340-L341 but that seems like a one off workaround where conceivably any public ValueVector APIs that require the allocator parameter should work on NullVectors. |
I prefer throwing over |
take |
…ector Signed-off-by: Maksim Yegorov <[email protected]>
…ector Signed-off-by: Maksim Yegorov <[email protected]>
…ector Signed-off-by: Maksim Yegorov <[email protected]> Code review comment: Add javadoc to getAllocator base method.
…ector Signed-off-by: Maksim Yegorov <[email protected]> Code review comment: Add javadoc to getAllocator base method. mvn spotless:apply linter
…ector Signed-off-by: Maksim Yegorov <[email protected]> Code review comment: Add javadoc to getAllocator base method. mvn spotless:apply linter retrigger checks
…44631) ### Rationale for this change Do not throw [UnsupportedOperationException("Tried to get allocator from NullVector")](https://github.com/apache/arrow/blob/release-18.0.0-rc0/java/vector/src/main/java/org/apache/arrow/vector/NullVector.java#L160) from [VectorSchemaRoot.slice()](https://github.com/apache/arrow/blob/release-18.0.0-rc0/java/vector/src/main/java/org/apache/arrow/vector/VectorSchemaRoot.java#L341) when slicing a VSR containing a NullVector or ZeroVector. Details in #44344 ### Are these changes tested? Added unit test that would trigger an UnsupportedOperationException on the legacy path. * GitHub Issue: #44344 Authored-by: Maksim Yegorov <[email protected]> Signed-off-by: David Li <[email protected]>
Issue resolved by pull request 44631 |
Describe the bug, including details regarding any error messages, version, and platform.
When slicing a VectorSchemaRoot wrapping a NullVector, NullVector.getAllocator() will throw
UnsupportedOperationException("Tried to get allocator from NullVector")
It appears that the call could pass in a
null
for allocator in https://github.com/apache/arrow/blob/release-17.0.0-rc2/java/vector/src/main/java/org/apache/arrow/vector/NullVector.java#L172-L174. Would it make sense to returnnull
instead of throw from NullVector.getAllocator()?Tangentially related to #30866 that was fixed in #41066 for some vector types.
Component(s)
Java
The text was updated successfully, but these errors were encountered: