liyafan82 commented on a change in pull request #8949:
URL: https://github.com/apache/arrow/pull/8949#discussion_r592197440



##########
File path: java/vector/src/main/java/org/apache/arrow/vector/VectorLoader.java
##########
@@ -79,7 +105,12 @@ private void loadBuffers(
     List<ArrowBuf> ownBuffers = new ArrayList<>(bufferLayoutCount);
     for (int j = 0; j < bufferLayoutCount; j++) {
       ArrowBuf nextBuf = buffers.next();
-      ownBuffers.add(codec.decompress(vector.getAllocator(), nextBuf));
+      // for vectors without nulls, the buffer is empty, so there is no need 
to decompress it.
+      ArrowBuf bufferToAdd = nextBuf.writerIndex() > 0 ? 
codec.decompress(vector.getAllocator(), nextBuf) : nextBuf;
+      ownBuffers.add(bufferToAdd);
+      if (decompressionPerformed) {
+        decompressedBuffers.add(bufferToAdd);
+      }
     }
     try {
       vector.loadFieldBuffers(fieldNode, ownBuffers);

Review comment:
       Good suggestion. This way, we do not need to change the public interface 
of `VectorLoader`. 




----------------------------------------------------------------
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.

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


Reply via email to