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



##########
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());
+    compressedBuffer.setLong(0, NO_COMPRESSION_LENGTH);
+    compressedBuffer.setBytes(SIZE_OF_UNCOMPRESSED_LENGTH, inputBuffer, 0, 
inputBuffer.writerIndex());
+    compressedBuffer.writerIndex(SIZE_OF_UNCOMPRESSED_LENGTH + 
inputBuffer.writerIndex());
+    return compressedBuffer;
+  }
+
+  /**
+   * Process decompression by decompressing the buffer as is.

Review comment:
       I chose `extractUncompressedBuffer`. Thanks for the good suggestion. 




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