SteveYurongSu commented on code in PR #9231:
URL: https://github.com/apache/iotdb/pull/9231#discussion_r1129022500


##########
tsfile/src/main/java/org/apache/iotdb/tsfile/compress/ICompressor.java:
##########
@@ -311,4 +316,61 @@ public CompressionType getType() {
       return GZIP;
     }
   }
+
+  class ZstdCompressor implements ICompressor {
+
+    private int compressionLevel;
+
+    public ZstdCompressor() {
+      super();
+      compressionLevel = Zstd.maxCompressionLevel();
+    }
+
+    @Override
+    public byte[] compress(byte[] data) throws IOException {
+      return Zstd.compress(data, compressionLevel);
+    }
+
+    @Override
+    public byte[] compress(byte[] data, int offset, int length) throws 
IOException {
+      if (data == null) {
+        return new byte[0];
+      }
+      byte[] toCompressData;
+      if (offset == 0 && length == data.length) {
+        toCompressData = data;
+      } else {
+        toCompressData = new byte[length];
+        System.arraycopy(data, offset, toCompressData, 0, length);

Review Comment:
   I'm not sure. Is this necessary?



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

Reply via email to