Package org.apache.parquet.hadoop
Class ParquetWriter<T>
java.lang.Object
org.apache.parquet.hadoop.ParquetWriter<T>
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
ExampleParquetWriter
Write records to a Parquet file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classParquetWriter.Builder<T,SELF extends ParquetWriter.Builder<T, SELF>> An abstract builder class for ParquetWriter instances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final org.apache.parquet.hadoop.metadata.CompressionCodecNamestatic final booleanstatic final booleanstatic final intstatic final org.apache.parquet.column.ParquetProperties.WriterVersionstatic final intstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionParquetWriter(org.apache.hadoop.fs.Path file, org.apache.hadoop.conf.Configuration conf, WriteSupport<T> writeSupport) Deprecated.ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport) Deprecated.will be removed in 2.0.0ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize) Deprecated.will be removed in 2.0.0ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, boolean enableDictionary, boolean validating) Deprecated.will be removed in 2.0.0ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating) Deprecated.will be removed in 2.0.0ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating, org.apache.parquet.column.ParquetProperties.WriterVersion writerVersion) Deprecated.will be removed in 2.0.0ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating, org.apache.parquet.column.ParquetProperties.WriterVersion writerVersion, org.apache.hadoop.conf.Configuration conf) Deprecated.will be removed in 2.0.0ParquetWriter(org.apache.hadoop.fs.Path file, ParquetFileWriter.Mode mode, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating, org.apache.parquet.column.ParquetProperties.WriterVersion writerVersion, org.apache.hadoop.conf.Configuration conf) Deprecated.will be removed in 2.0.0 -
Method Summary
-
Field Details
-
DEFAULT_BLOCK_SIZE
public static final int DEFAULT_BLOCK_SIZE- See Also:
-
DEFAULT_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE- See Also:
-
DEFAULT_COMPRESSION_CODEC_NAME
public static final org.apache.parquet.hadoop.metadata.CompressionCodecName DEFAULT_COMPRESSION_CODEC_NAME -
DEFAULT_IS_DICTIONARY_ENABLED
public static final boolean DEFAULT_IS_DICTIONARY_ENABLED- See Also:
-
DEFAULT_IS_VALIDATING_ENABLED
public static final boolean DEFAULT_IS_VALIDATING_ENABLED- See Also:
-
DEFAULT_WRITER_VERSION
public static final org.apache.parquet.column.ParquetProperties.WriterVersion DEFAULT_WRITER_VERSION -
OBJECT_MODEL_NAME_PROP
- See Also:
-
MAX_PADDING_SIZE_DEFAULT
public static final int MAX_PADDING_SIZE_DEFAULT- See Also:
-
-
Constructor Details
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize) throws IOException Deprecated.will be removed in 2.0.0Create a new ParquetWriter. (with dictionary encoding enabled and validation off)- Parameters:
file- the file to createwriteSupport- the implementation to write a record to a RecordConsumercompressionCodecName- the compression codec to useblockSize- the block size thresholdpageSize- the page size threshold- Throws:
IOException- if there is an error while writing
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, boolean enableDictionary, boolean validating) throws IOException Deprecated.will be removed in 2.0.0Create a new ParquetWriter.- Parameters:
file- the file to createwriteSupport- the implementation to write a record to a RecordConsumercompressionCodecName- the compression codec to useblockSize- the block size thresholdpageSize- the page size threshold (both data and dictionary)enableDictionary- to turn dictionary encoding onvalidating- to turn on validation using the schema- Throws:
IOException- if there is an error while writing
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating) throws IOException Deprecated.will be removed in 2.0.0Create a new ParquetWriter.- Parameters:
file- the file to createwriteSupport- the implementation to write a record to a RecordConsumercompressionCodecName- the compression codec to useblockSize- the block size thresholdpageSize- the page size thresholddictionaryPageSize- the page size threshold for the dictionary pagesenableDictionary- to turn dictionary encoding onvalidating- to turn on validation using the schema- Throws:
IOException- if there is an error while writing
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating, org.apache.parquet.column.ParquetProperties.WriterVersion writerVersion) throws IOException Deprecated.will be removed in 2.0.0Create a new ParquetWriter.Directly instantiates a Hadoop
Configurationwhich reads configuration from the classpath.- Parameters:
file- the file to createwriteSupport- the implementation to write a record to a RecordConsumercompressionCodecName- the compression codec to useblockSize- the block size thresholdpageSize- the page size thresholddictionaryPageSize- the page size threshold for the dictionary pagesenableDictionary- to turn dictionary encoding onvalidating- to turn on validation using the schemawriterVersion- version of parquetWriter fromParquetProperties.WriterVersion- Throws:
IOException- if there is an error while writing
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating, org.apache.parquet.column.ParquetProperties.WriterVersion writerVersion, org.apache.hadoop.conf.Configuration conf) throws IOException Deprecated.will be removed in 2.0.0Create a new ParquetWriter.- Parameters:
file- the file to createwriteSupport- the implementation to write a record to a RecordConsumercompressionCodecName- the compression codec to useblockSize- the block size thresholdpageSize- the page size thresholddictionaryPageSize- the page size threshold for the dictionary pagesenableDictionary- to turn dictionary encoding onvalidating- to turn on validation using the schemawriterVersion- version of parquetWriter fromParquetProperties.WriterVersionconf- Hadoop configuration to use while accessing the filesystem- Throws:
IOException- if there is an error while writing
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, ParquetFileWriter.Mode mode, WriteSupport<T> writeSupport, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName, int blockSize, int pageSize, int dictionaryPageSize, boolean enableDictionary, boolean validating, org.apache.parquet.column.ParquetProperties.WriterVersion writerVersion, org.apache.hadoop.conf.Configuration conf) throws IOException Deprecated.will be removed in 2.0.0Create a new ParquetWriter.- Parameters:
file- the file to createmode- file creation modewriteSupport- the implementation to write a record to a RecordConsumercompressionCodecName- the compression codec to useblockSize- the block size thresholdpageSize- the page size thresholddictionaryPageSize- the page size threshold for the dictionary pagesenableDictionary- to turn dictionary encoding onvalidating- to turn on validation using the schemawriterVersion- version of parquetWriter fromParquetProperties.WriterVersionconf- Hadoop configuration to use while accessing the filesystem- Throws:
IOException- if there is an error while writing
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, WriteSupport<T> writeSupport) throws IOException Deprecated.will be removed in 2.0.0Create a new ParquetWriter. The default block size is 128 MB. The default page size is 1 MB. Default compression is no compression. Dictionary encoding is disabled.- Parameters:
file- the file to createwriteSupport- the implementation to write a record to a RecordConsumer- Throws:
IOException- if there is an error while writing
-
ParquetWriter
@Deprecated public ParquetWriter(org.apache.hadoop.fs.Path file, org.apache.hadoop.conf.Configuration conf, WriteSupport<T> writeSupport) throws IOException Deprecated.- Throws:
IOException
-
-
Method Details
-
write
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getDataSize
public long getDataSize()- Returns:
- the total size of data written to the file and buffered in memory
-