sunchao commented on a change in pull request #11709:
URL: https://github.com/apache/arrow/pull/11709#discussion_r761559220
##########
File path:
java/vector/src/main/java/org/apache/arrow/vector/BitVectorHelper.java
##########
@@ -329,7 +329,8 @@ public static ArrowBuf loadValidityBuffer(final
ArrowFieldNode fieldNode,
final int valueCount = fieldNode.getLength();
ArrowBuf newBuffer = null;
/* either all NULLs or all non-NULLs */
- if (fieldNode.getNullCount() == 0 || fieldNode.getNullCount() ==
valueCount) {
+ if (sourceValidityBuffer == null && (fieldNode.getNullCount() == 0 ||
Review comment:
It turned out this is because the ORC adapter wraps null validity buffer
from native side with `OrcMemoryJniWrapper`, which then gets converted into
`ArrowBuf` with `memoryAddress` equals to 0 (i.e., it wraps a null buffer).
With the change in this PR, the Java side will think the `ArrowBuf` is valid
and thus will skip allocating new buffer. However it is actually invalid and
thus will cause a series of issues.
I added an additional check of the `ArrowBuf`'s memory address, to make sure
it is indeed a null validity buffer.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]