Jackie-Jiang commented on code in PR #19946:
URL: https://github.com/apache/pinot/pull/19946#discussion_r4319536464


##########
pinot-common/src/main/java/org/apache/pinot/common/compression/Lz4CompressorStreamProvider.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.common.compression;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Locale;
+import java.util.Set;
+import net.jpountz.lz4.LZ4Factory;
+import net.jpountz.lz4.LZ4FrameOutputStream;
+import net.jpountz.lz4.LZ4FrameOutputStream.BLOCKSIZE;
+import net.jpountz.lz4.LZ4FrameOutputStream.FLG.Bits;
+import net.jpountz.xxhash.XXHashFactory;
+import org.apache.commons.compress.compressors.CompressorException;
+import org.apache.commons.compress.compressors.CompressorInputStream;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+import org.apache.commons.compress.compressors.CompressorStreamFactory;
+import org.apache.commons.compress.compressors.CompressorStreamProvider;
+import 
org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorOutputStream;
+import org.apache.commons.io.output.CloseShieldOutputStream;
+
+
+/// Adds explicit LZ4 frame encoders to the Commons Compress factory. This 
provider is stateless and thread-safe;
+/// returned streams are not thread-safe. All variants use the Commons reader 
for existing frame compatibility.
+public class Lz4CompressorStreamProvider implements CompressorStreamProvider {
+  /// Preserves the existing Commons Compress encoder.
+  public static final String LZ4_DEFAULT = "lz4-default";

Review Comment:
   Optional simplification: could we use the existing `lz4-framed` name for the 
Commons encoder and drop `lz4-default`? That removes a redundant public alias 
and the Commons-specific constructor branch, letting this adapter serve only 
fast/HC and `_frameOut` be typed as `LZ4FrameOutputStream`. Keeping the alias 
is reasonable if the uniform default/fast/hc naming is intentional.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to