You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "barronw (via GitHub)" <gi...@apache.org> on 2024/03/06 13:53:59 UTC

[I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

barronw opened a new issue, #40383:
URL: https://github.com/apache/arrow/issues/40383

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   VectorUnloader [appendNodes](https://github.com/apache/arrow/blob/main/java/vector/src/main/java/org/apache/arrow/vector/VectorUnloader.java#L92) checks the number of buffers based on the field type of a vector. This check fails if the VectorSchemaRoot has a NullVector that for example has integer as the logical field type.
   
   Is this the expected behavior?
   
   ### Component(s)
   
   Java


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981228661

   Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981058359

   At least without looking into the code, yes, because a null slot should still exist in memory (the value is not defined, but should be initialized)
   
   https://arrow.apache.org/docs/format/Columnar.html#validity-bitmaps
   
   > Arrays having a 0 null count may choose to not allocate the validity bitmap; how this is represented depends on the implementation (for example, a C++ implementation may represent such an “absent” validity bitmap using a NULL pointer).
   
   > Array slots which are null are not required to have a particular value; any “masked” memory can have any value and need not be zeroed, though implementations frequently choose to zero memory for null values.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "barronw (via GitHub)" <gi...@apache.org>.
barronw closed issue #40383: [JAVA] VectorUnloader does not correctly handle NullVector
URL: https://github.com/apache/arrow/issues/40383


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "barronw (via GitHub)" <gi...@apache.org>.
barronw commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981046883

   > I don't think anything optimizes the all-null case: implementations will allocate a validity buffer of all zeroes.
   
   In this case, will a data buffer also be allocated according to the length of the vector?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "barronw (via GitHub)" <gi...@apache.org>.
barronw commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981032877

   Thanks for the response @lidavidm. Sounds like I'm misusing NullVector. Is there a way to construct a vector that has type Int without allocating buffers if all values are null?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981041605

   I don't think so. I don't recall off the top of my head whether this applies to Java, but other Arrow implementations often optimize the case where all values are NOT null: they won't necessarily allocate a validity buffer. However, I don't think anything optimizes the all-null case: implementations will allocate a validity buffer of all zeroes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "barronw (via GitHub)" <gi...@apache.org>.
barronw closed issue #40383: [Java] VectorUnloader does not correctly handle NullVector
URL: https://github.com/apache/arrow/issues/40383


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "barronw (via GitHub)" <gi...@apache.org>.
barronw commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981141014

   Why does the constructor for NullVector accept a field of any type?
   
   https://github.com/apache/arrow/blob/main/java/vector/src/main/java/org/apache/arrow/vector/NullVector.java#L70-L98


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "barronw (via GitHub)" <gi...@apache.org>.
barronw commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981226882

   That makes sense. I can open a separate issue for this problem and submit a fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "barronw (via GitHub)" <gi...@apache.org>.
barronw commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981070902

   That checks out with my understanding of the code. Thanks for all of your help!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JAVA] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1980933290

   Is it possible to provide some sample code? It sounds like the schema has Int but the actual vector is NullVector - that shouldn't happen, it should still be IntVector even if all the values are null (null is a distinct type)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] VectorUnloader does not correctly handle NullVector [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #40383:
URL: https://github.com/apache/arrow/issues/40383#issuecomment-1981220577

   I think that's a mistake/an overly flexible API, from looking at the commit. It's only used in one place without a null type and I believe that usage is wrong/needs fixing. The original commit was only about letting you change the field name, not the field type. https://lists.apache.org/thread/9hyhlrbvy9bhgvxp482w8b0cj0zfz8rc


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org