linliu-code commented on code in PR #12866:
URL: https://github.com/apache/hudi/pull/12866#discussion_r2105672850
##########
hudi-io/src/main/java/org/apache/hudi/io/compress/airlift/HoodieAirliftGzipDecompressor.java:
##########
@@ -50,4 +52,12 @@ public int decompress(InputStream compressedInput,
return readFully(stream, targetByteArray, offset, length);
}
}
+
+ public byte[] compress(byte[] data) throws IOException {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ try (GZIPOutputStream gzipOutputStream = new
GZIPOutputStream(byteArrayOutputStream)) {
+ gzipOutputStream.write(data);
+ }
+ return byteArrayOutputStream.toByteArray();
Review Comment:
The compressed output is wrapped into another ByteBuffer. The entire writer
operates on ByteBuffer. There is not cost to wrap the bytes into a ByteBuffer.
So far it should be ok.
--
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]