xiangfu0 commented on code in PR #19946: URL: https://github.com/apache/pinot/pull/19946#discussion_r4319963240
########## 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: Removed the redundant `lz4-default` alias and its Commons-specific constructor branch. The existing `lz4-framed` name retains the Commons encoder, and the adapter now handles only fast/HC with `_frameOut` typed as `LZ4FrameOutputStream`. `.tar.lz4` selects `lz4-fast` through the normal factory mapping; gzip remains the overall default for generic `.tar.compressed` archives. Existing tests verify both defaults and legacy framed compatibility. All 152 targeted tests, applicable precommit checks, and independent review passed. Fixed in https://github.com/apache/pinot/commit/709aaeb2b483bb9084dc18d48a2f1f9de3335d91. -- 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]
