Package org.apache.parquet.hadoop
Class CodecFactory
java.lang.Object
org.apache.parquet.hadoop.CodecFactory
- All Implemented Interfaces:
org.apache.parquet.compression.CompressionCodecFactory
public class CodecFactory
extends Object
implements org.apache.parquet.compression.CompressionCodecFactory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.will be removed in 2.0.0; use CompressionCodecFactory.BytesInputCompressor instead.static classDeprecated.will be removed in 2.0.0; use CompressionCodecFactory.BytesInputDecompressor instead.Nested classes/interfaces inherited from interface org.apache.parquet.compression.CompressionCodecFactory
org.apache.parquet.compression.CompressionCodecFactory.BytesInputCompressor, org.apache.parquet.compression.CompressionCodecFactory.BytesInputDecompressor -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.parquet.conf.ParquetConfigurationprotected final org.apache.hadoop.conf.ConfigurationDeprecated.protected final int -
Constructor Summary
ConstructorsConstructorDescriptionCodecFactory(org.apache.hadoop.conf.Configuration configuration, int pageSize) Create a new codec factory.CodecFactory(org.apache.parquet.conf.ParquetConfiguration configuration, int pageSize) Create a new codec factory. -
Method Summary
Modifier and TypeMethodDescriptionprotected CodecFactory.BytesCompressorcreateCompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) protected CodecFactory.BytesCompressorcreateCompressorAtLevel(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName, int level) protected CodecFactory.BytesDecompressorcreateDecompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) static CodecFactorycreateDirectCodecFactory(org.apache.hadoop.conf.Configuration config, org.apache.parquet.bytes.ByteBufferAllocator allocator, int pageSize) Create a codec factory that will provide compressors and decompressors that will work natively with ByteBuffers backed by direct memory.protected org.apache.hadoop.io.compress.CompressionCodecgetCodec(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) getCompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) getCompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName, int level) getDecompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) voidrelease()
-
Field Details
-
CODEC_BY_NAME
-
conf
protected final org.apache.parquet.conf.ParquetConfiguration conf -
pageSize
protected final int pageSize -
configuration
Deprecated.
-
-
Constructor Details
-
CodecFactory
public CodecFactory(org.apache.hadoop.conf.Configuration configuration, int pageSize) Create a new codec factory.- Parameters:
configuration- used to pass compression codec configuration informationpageSize- the expected page size, does not set a hard limit, currently just used to set the initial size of the output stream used when compressing a buffer. If this factory is only used to construct decompressors this parameter has no impact on the function of the factory
-
CodecFactory
public CodecFactory(org.apache.parquet.conf.ParquetConfiguration configuration, int pageSize) Create a new codec factory.- Parameters:
configuration- used to pass compression codec configuration informationpageSize- the expected page size, does not set a hard limit, currently just used to set the initial size of the output stream used when compressing a buffer. If this factory is only used to construct decompressors this parameter has no impact on the function of the factory
-
-
Method Details
-
createDirectCodecFactory
public static CodecFactory createDirectCodecFactory(org.apache.hadoop.conf.Configuration config, org.apache.parquet.bytes.ByteBufferAllocator allocator, int pageSize) Create a codec factory that will provide compressors and decompressors that will work natively with ByteBuffers backed by direct memory.- Parameters:
config- configuration options for different compression codecsallocator- an allocator for creating result buffers during compression and decompression, must provide buffers backed by Direct memory and return true for the isDirect() method on the ByteBufferAllocator interfacepageSize- the default page size. This does not set a hard limit on the size of buffers that can be compressed, but performance may be improved by setting it close to the expected size of buffers (in the case of parquet, pages) that will be compressed. This setting is unused in the case of decompressing data, as parquet always records the uncompressed size of a buffer. If this CodecFactory is only going to be used for decompressors, this parameter will not impact the function of the factory.- Returns:
- a configured direct codec factory
-
getCompressor
public CodecFactory.BytesCompressor getCompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) - Specified by:
getCompressorin interfaceorg.apache.parquet.compression.CompressionCodecFactory
-
getCompressor
public CodecFactory.BytesCompressor getCompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName, int level) - Specified by:
getCompressorin interfaceorg.apache.parquet.compression.CompressionCodecFactory
-
getDecompressor
public CodecFactory.BytesDecompressor getDecompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) - Specified by:
getDecompressorin interfaceorg.apache.parquet.compression.CompressionCodecFactory
-
createCompressor
protected CodecFactory.BytesCompressor createCompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) -
createDecompressor
protected CodecFactory.BytesDecompressor createDecompressor(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) -
createCompressorAtLevel
protected CodecFactory.BytesCompressor createCompressorAtLevel(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName, int level) -
getCodec
protected org.apache.hadoop.io.compress.CompressionCodec getCodec(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) - Parameters:
codecName- the requested codec- Returns:
- the corresponding hadoop codec. null if UNCOMPRESSED
-
release
public void release()- Specified by:
releasein interfaceorg.apache.parquet.compression.CompressionCodecFactory
-