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



##########
File path: 
java/vector/src/main/java/org/apache/arrow/vector/compression/CompressionUtil.java
##########
@@ -47,14 +57,21 @@ public static ArrowBodyCompression 
createBodyCompression(CompressionCodec codec)
   }
 
   /**
-   * Creates the {@link CompressionCodec} given the compression type.
+   * Process compression by compressing the buffer as is.
    */
-  public static CompressionCodec createCodec(byte compressionType) {
-    switch (compressionType) {
-      case NoCompressionCodec.COMPRESSION_TYPE:
-        return NoCompressionCodec.INSTANCE;
-      default:
-        throw new IllegalArgumentException("Compression type not supported: " 
+ compressionType);
-    }
+  public static ArrowBuf compressRawBuffer(BufferAllocator allocator, ArrowBuf 
inputBuffer) {
+    ArrowBuf compressedBuffer = allocator.buffer(SIZE_OF_UNCOMPRESSED_LENGTH + 
inputBuffer.writerIndex());

Review comment:
       This is a good point. It could be useful in many scenarios.
   
   However, so far, I do not have a method to solve it (without changing our 
APIs significantly).
   
   The fundamental reason is that the compression feature is only used in 
`VectorLoader`, which requires a single compressed buffer for each input 
buffer. In addition, we do not have an efficient way to combine two `ArrowBuf` 
objects. 




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