2525import org .apache .parquet .bytes .BytesInput ;
2626import org .apache .parquet .bytes .DirectByteBufferAllocator ;
2727import org .apache .parquet .compression .CompressionCodecFactory ;
28- import org .apache .parquet .hadoop .CodecFactory ;
28+ import org .apache .parquet .compression .DefaultCompressionCodecFactory ;
29+ import org .apache .parquet .conf .HadoopParquetConfiguration ;
2930import org .apache .parquet .hadoop .metadata .CompressionCodecName ;
3031import org .openjdk .jmh .annotations .Benchmark ;
3132import org .openjdk .jmh .annotations .BenchmarkMode ;
4647 *
4748 * <p>Measures the performance of {@link CompressionCodecFactory.BytesInputCompressor}
4849 * and {@link CompressionCodecFactory.BytesInputDecompressor} for each supported codec,
49- * comparing the heap-based {@link CodecFactory } path (what all production users take)
50+ * comparing the heap-based {@link DefaultCompressionCodecFactory } path (what all production users take)
5051 * against the direct-memory {@code DirectCodecFactory} path (off-heap ByteBuffers).
5152 *
5253 * <p>This benchmark isolates the codec hot path from file I/O, encoding, and other
@@ -75,7 +76,7 @@ public class CompressionBenchmark {
7576
7677 private CompressionCodecFactory .BytesInputCompressor compressor ;
7778 private CompressionCodecFactory .BytesInputDecompressor decompressor ;
78- private CodecFactory factory ;
79+ private DefaultCompressionCodecFactory factory ;
7980
8081 @ Setup (Level .Trial )
8182 public void setup () throws IOException {
@@ -84,9 +85,10 @@ public void setup() throws IOException {
8485
8586 Configuration conf = new Configuration ();
8687 if ("DIRECT" .equals (factoryType )) {
87- factory = CodecFactory .createDirectCodecFactory (conf , DirectByteBufferAllocator .getInstance (), pageSize );
88+ factory = DefaultCompressionCodecFactory .createDirectCodecFactory (
89+ new HadoopParquetConfiguration (conf ), DirectByteBufferAllocator .getInstance (), pageSize );
8890 } else {
89- factory = new CodecFactory ( conf , pageSize );
91+ factory = new DefaultCompressionCodecFactory ( new HadoopParquetConfiguration ( conf ) , pageSize );
9092 }
9193 CompressionCodecName codecName = CompressionCodecName .valueOf (codec );
9294
0 commit comments