Package com.jerolba.carpet
Class CarpetWriter.Builder<T>
java.lang.Object
com.jerolba.carpet.CarpetWriter.Builder<T>
- Enclosing class:
- CarpetWriter<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Set a property that will be available to the read path.Enables dictionary encoding for the constructed writer.Enables writing page level checksums for the constructed writer.Enables validation for the constructed writer.withAdaptiveBloomFilterEnabled(boolean enabled) When NDV (number of distinct values) for a specified column is not set, whether to use `AdaptiveBloomFilter` to automatically adjust the BloomFilter size according to `parquet.bloom.filter.max.bytes`withAllocator(org.apache.parquet.bytes.ByteBufferAllocator allocator) Sets the ByteBuffer allocator instance to be used for allocating memory for writing.withBloomFilterCandidateNumber(String columnPath, int number) When `AdaptiveBloomFilter` is enabled, set how many bloom filter candidates to use.withBloomFilterEnabled(boolean enabled) Sets the bloom filter enabled/disabledwithBloomFilterEnabled(String columnPath, boolean enabled) Sets the bloom filter enabled/disabled for the specified column.withBloomFilterFPP(String columnPath, double fpp) withBloomFilterNDV(String columnPath, long ndv) Sets the NDV (number of distinct values) for the specified column.withByteStreamSplitEncoding(boolean enableByteStreamSplit) Enable or disable BYTE_STREAM_SPLIT encoding for FLOAT and DOUBLE columns.withCodecFactory(org.apache.parquet.compression.CompressionCodecFactory codecFactory) Set thecodec factoryused by the constructed writer.withColumnIndexTruncateLength(int length) Sets the length to be used for truncating binary values in a binary column index.withColumnNamingStrategy(ColumnNamingStrategy columnNamingStrategy) Set the strategy to use generating message and record column nameswithCompressionCodec(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) Set thecompression codecused by the constructed writer.withConf(org.apache.hadoop.conf.Configuration conf) Set theConfigurationused by the constructed writer.withConf(org.apache.parquet.conf.ParquetConfiguration conf) Set theParquetConfigurationused by the constructed writer.withDefaultDecimal(int precision, int scale) Set Decimal precision and scalewithDefaultTimeUnit(TimeUnit defaultTimeUnit) Set the time unit resolution writing TIME or TIMESTAMP fields: milliseconds microseconds nanosecondswithDictionaryEncoding(boolean enableDictionary) Enable or disable dictionary encoding for the constructed writer.withDictionaryEncoding(String columnPath, boolean enableDictionary) Enable or disable dictionary encoding of the specified column for the constructed writer.withDictionaryPageSize(int dictionaryPageSize) Set the Parquet format dictionary page size used by the constructed writer.withEncryption(org.apache.parquet.crypto.FileEncryptionProperties encryptionProperties) Set thefile encryption propertiesused by the constructed writer.withExtraMetaData(String key, String value) Add to writer metadata to include in the generated parquet file.withExtraMetaData(Map<String, String> extraMetaData) Add to writer metadata to include in the generated parquet file.withLevelStructure(AnnotatedLevels annotatedLevels) Set the type of collections type that will be generated following the LogicalTypes definitionwithMaxBloomFilterBytes(int maxBloomFilterBytes) Set max Bloom filter bytes for related columns.withMaxPaddingSize(int maxPaddingSize) Set the maximum amount of padding, in bytes, that will be used to align row groups with blocks in the underlying filesystem.withMaxRowCountForPageSizeCheck(int max) Sets the maximum number of rows to write before a page size check is done.withMinRowCountForPageSizeCheck(int min) Sets the minimum number of rows to write before a page size check is done.withPageRowCountLimit(int rowCount) Sets the Parquet format page row count limit used by the constructed writer.withPageSize(int pageSize) Set the Parquet format page size used by the constructed writer.withPageWriteChecksumEnabled(boolean enablePageWriteChecksum) Enables writing page level checksums for the constructed writer.withRowGroupSize(long rowGroupSize) Set the Parquet format row group size used by the constructed writer.withStatisticsTruncateLength(int length) Sets the length which the min/max binary values in row groups are truncated to.withValidation(boolean enableValidation) Enable or disable validation for the constructed writer.withWriteMode(org.apache.parquet.hadoop.ParquetFileWriter.Mode mode) Set thewrite modeused when creating the backing file for this writer.withWriterVersion(org.apache.parquet.column.ParquetProperties.WriterVersion version) Set theformat versionused by the constructed writer.
-
Constructor Details
-
Builder
-
Builder
-
-
Method Details
-
withConf
Set theConfigurationused by the constructed writer.- Parameters:
conf- aConfiguration- Returns:
- this builder for method chaining.
-
withConf
Set theParquetConfigurationused by the constructed writer.- Parameters:
conf- aParquetConfiguration- Returns:
- this builder for method chaining.
-
withWriteMode
Set thewrite modeused when creating the backing file for this writer.- Parameters:
mode- aParquetFileWriter.Mode- Returns:
- this builder for method chaining.
-
withCompressionCodec
public CarpetWriter.Builder<T> withCompressionCodec(org.apache.parquet.hadoop.metadata.CompressionCodecName codecName) Set thecompression codecused by the constructed writer.- Parameters:
codecName- aCompressionCodecName- Returns:
- this builder for method chaining.
-
withCodecFactory
public CarpetWriter.Builder<T> withCodecFactory(org.apache.parquet.compression.CompressionCodecFactory codecFactory) Set thecodec factoryused by the constructed writer.- Parameters:
codecFactory- aCompressionCodecFactory- Returns:
- this builder for method chaining.
-
withEncryption
public CarpetWriter.Builder<T> withEncryption(org.apache.parquet.crypto.FileEncryptionProperties encryptionProperties) Set thefile encryption propertiesused by the constructed writer.- Parameters:
encryptionProperties- aFileEncryptionProperties- Returns:
- this builder for method chaining.
-
withRowGroupSize
Set the Parquet format row group size used by the constructed writer.- Parameters:
rowGroupSize- an integer size in bytes- Returns:
- this builder for method chaining.
-
withMaxPaddingSize
Set the maximum amount of padding, in bytes, that will be used to align row groups with blocks in the underlying filesystem. If the underlying filesystem is not a block filesystem like HDFS, this has no effect.- Parameters:
maxPaddingSize- an integer size in bytes- Returns:
- this builder for method chaining.
-
enableValidation
Enables validation for the constructed writer.- Returns:
- this builder for method chaining.
-
withValidation
Enable or disable validation for the constructed writer.- Parameters:
enableValidation- whether validation should be enabled- Returns:
- this builder for method chaining.
-
withPageSize
Set the Parquet format page size used by the constructed writer.- Parameters:
pageSize- an integer size in bytes- Returns:
- this builder for method chaining.
-
withPageRowCountLimit
Sets the Parquet format page row count limit used by the constructed writer.- Parameters:
rowCount- limit for the number of rows stored in a page- Returns:
- this builder for method chaining
-
withDictionaryPageSize
Set the Parquet format dictionary page size used by the constructed writer.- Parameters:
dictionaryPageSize- an integer size in bytes- Returns:
- this builder for method chaining.
-
enableDictionaryEncoding
Enables dictionary encoding for the constructed writer.- Returns:
- this builder for method chaining.
-
withDictionaryEncoding
Enable or disable dictionary encoding for the constructed writer.- Parameters:
enableDictionary- whether dictionary encoding should be enabled- Returns:
- this builder for method chaining.
-
withByteStreamSplitEncoding
Enable or disable BYTE_STREAM_SPLIT encoding for FLOAT and DOUBLE columns.- Parameters:
enableByteStreamSplit- whether BYTE_STREAM_SPLIT encoding should be enabled- Returns:
- this builder for method chaining.
-
withDictionaryEncoding
Enable or disable dictionary encoding of the specified column for the constructed writer.- Parameters:
columnPath- the path of the column (dot-string)enableDictionary- whether dictionary encoding should be enabled- Returns:
- this builder for method chaining.
-
withWriterVersion
public CarpetWriter.Builder<T> withWriterVersion(org.apache.parquet.column.ParquetProperties.WriterVersion version) Set theformat versionused by the constructed writer.- Parameters:
version- aWriterVersion- Returns:
- this builder for method chaining.
-
enablePageWriteChecksum
Enables writing page level checksums for the constructed writer.- Returns:
- this builder for method chaining.
-
withPageWriteChecksumEnabled
Enables writing page level checksums for the constructed writer.- Parameters:
enablePageWriteChecksum- whether page checksums should be written out- Returns:
- this builder for method chaining.
-
withMaxBloomFilterBytes
Set max Bloom filter bytes for related columns.- Parameters:
maxBloomFilterBytes- the max bytes of a Bloom filter bitset for a column.- Returns:
- this builder for method chaining
-
withBloomFilterNDV
Sets the NDV (number of distinct values) for the specified column.- Parameters:
columnPath- the path of the column (dot-string)ndv- the NDV of the column- Returns:
- this builder for method chaining.
-
withBloomFilterFPP
-
withAdaptiveBloomFilterEnabled
When NDV (number of distinct values) for a specified column is not set, whether to use `AdaptiveBloomFilter` to automatically adjust the BloomFilter size according to `parquet.bloom.filter.max.bytes`- Parameters:
enabled- whether to write bloom filter for the column
-
withBloomFilterCandidateNumber
When `AdaptiveBloomFilter` is enabled, set how many bloom filter candidates to use.- Parameters:
columnPath- the path of the column (dot-string)number- the number of candidate
-
withBloomFilterEnabled
Sets the bloom filter enabled/disabled- Parameters:
enabled- whether to write bloom filters- Returns:
- this builder for method chaining
-
withBloomFilterEnabled
Sets the bloom filter enabled/disabled for the specified column. If not set for the column specifically the default enabled/disabled state will take place. SeewithBloomFilterEnabled(boolean).- Parameters:
columnPath- the path of the column (dot-string)enabled- whether to write bloom filter for the column- Returns:
- this builder for method chaining
-
withMinRowCountForPageSizeCheck
Sets the minimum number of rows to write before a page size check is done.- Parameters:
min- writes at least `min` rows before invoking a page size check- Returns:
- this builder for method chaining
-
withMaxRowCountForPageSizeCheck
Sets the maximum number of rows to write before a page size check is done.- Parameters:
max- makes a page size check after `max` rows have been written- Returns:
- this builder for method chaining
-
withColumnIndexTruncateLength
Sets the length to be used for truncating binary values in a binary column index.- Parameters:
length- the length to truncate to- Returns:
- this builder for method chaining
-
withStatisticsTruncateLength
Sets the length which the min/max binary values in row groups are truncated to.- Parameters:
length- the length to truncate to- Returns:
- this builder for method chaining
-
config
Set a property that will be available to the read path. For writers that use a Hadoop configuration, this is the recommended way to add configuration values.- Parameters:
property- a String property namevalue- a String property value- Returns:
- this builder for method chaining.
-
withExtraMetaData
Add to writer metadata to include in the generated parquet file.- Parameters:
extraMetaData- to add- Returns:
- this builder for method chaining.
-
withExtraMetaData
Add to writer metadata to include in the generated parquet file.- Parameters:
key- of the metadata to addvalue- of the metadata to add- Returns:
- this builder for method chaining.
-
withAllocator
public CarpetWriter.Builder<T> withAllocator(org.apache.parquet.bytes.ByteBufferAllocator allocator) Sets the ByteBuffer allocator instance to be used for allocating memory for writing.- Parameters:
allocator- the allocator instance- Returns:
- this builder for method chaining
-
withLevelStructure
Set the type of collections type that will be generated following the LogicalTypes definition- Parameters:
annotatedLevels- an Enum configuring the number of levels- Returns:
- this builder for method chaining.
-
withColumnNamingStrategy
Set the strategy to use generating message and record column names- Parameters:
columnNamingStrategy- an Enum configuring the strategy to use- Returns:
- this builder for method chaining.
-
withDefaultTimeUnit
Set the time unit resolution writing TIME or TIMESTAMP fields:- milliseconds
- microseconds
- nanoseconds
- Parameters:
defaultTimeUnit- an Enum configuring the resolution to use- Returns:
- this builder for method chaining.
-
withDefaultDecimal
Set Decimal precision and scale- Returns:
- this builder for method chaining.
-
build
- Throws:
IOException
-