Class RewriteOptions.Builder
- Enclosing class:
- RewriteOptions
RewriteOptions which is used for constructing ParquetRewriter.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.fs.Path> inputFiles, List<org.apache.hadoop.fs.Path> inputFilesToJoin, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.Builder(org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.fs.Path> inputFiles, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.Builder(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path inputFile, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.Builder(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path inputFile, org.apache.hadoop.fs.Path inputFileToJoin, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.Builder(org.apache.parquet.conf.ParquetConfiguration conf, List<org.apache.parquet.io.InputFile> inputFiles, List<org.apache.parquet.io.InputFile> inputFilesToJoin, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions.Builder(org.apache.parquet.conf.ParquetConfiguration conf, List<org.apache.parquet.io.InputFile> inputFiles, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions.Builder(org.apache.parquet.conf.ParquetConfiguration conf, org.apache.parquet.io.InputFile inputFile, org.apache.parquet.io.InputFile inputFileToJoin, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions.Builder(org.apache.parquet.conf.ParquetConfiguration conf, org.apache.parquet.io.InputFile inputFile, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions. -
Method Summary
Modifier and TypeMethodDescriptionaddInputFile(org.apache.hadoop.fs.Path path) Add an input file to read from.addInputFile(org.apache.parquet.io.InputFile inputFile) Add an input file to read from.addInputFilesToJoin(org.apache.parquet.io.InputFile fileToJoin) Add an input file to join.addInputFileToJoinColumns(org.apache.hadoop.fs.Path path) Add an input join file to read from.build()Build the RewriterOptions.Set the columns to encrypt.encryptionProperties(FileEncryptionProperties fileEncryptionProperties) Set the encryption properties to use for the output file.ignoreJoinFilesMetadata(boolean ignoreJoinFilesMetadata) Set a flag whether metadata from join files should be ignored.indexCacheStrategy(IndexCache.CacheStrategy cacheStrategy) Set the index(ColumnIndex, Offset and BloomFilter) cache strategy.Set the columns to mask.overwriteInputWithJoinColumns(boolean overwriteInputWithJoinColumns) Set a flag whether columns from join files need to overwrite columns from the main input files.Set the columns to prune.renameColumns(Map<String, String> renameColumns) Set the columns to be renamed.transform(org.apache.parquet.hadoop.metadata.CompressionCodecName newCodecName) Set the compression codec to use for the output file.
-
Constructor Details
-
Builder
public Builder(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path inputFile, org.apache.hadoop.fs.Path inputFileToJoin, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFile- input file path to read frominputFileToJoin- input join file path to read fromoutputFile- output file path to rewrite to
-
Builder
public Builder(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path inputFile, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFile- input file path to read fromoutputFile- output file path to rewrite to
-
Builder
public Builder(org.apache.parquet.conf.ParquetConfiguration conf, org.apache.parquet.io.InputFile inputFile, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFile- input file to read fromoutputFile- output file to rewrite to
-
Builder
public Builder(org.apache.parquet.conf.ParquetConfiguration conf, org.apache.parquet.io.InputFile inputFile, org.apache.parquet.io.InputFile inputFileToJoin, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFile- input file to read frominputFileToJoin- input join file to read fromoutputFile- output file to rewrite to
-
Builder
public Builder(org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.fs.Path> inputFiles, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.Please note that if merging more than one file, the schema of all files must be the same. Otherwise, the rewrite will fail.
The rewrite will keep original row groups from all input files. This may not be optimal if row groups are very small and will not solve small file problems. Instead, it will make it worse to have a large file footer in the output file. TODO: support rewrite by record to break the original row groups into reasonable ones.
See
ParquetRewriterfor more details.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFiles- list of input file paths to read fromoutputFile- output file path to rewrite to
-
Builder
public Builder(org.apache.parquet.conf.ParquetConfiguration conf, List<org.apache.parquet.io.InputFile> inputFiles, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions.Please note that if merging more than one file, the schema of all files must be the same. Otherwise, the rewrite will fail.
The rewrite will keep original row groups from all input files. This may not be optimal if row groups are very small and will not solve small file problems. Instead, it will make it worse to have a large file footer in the output file. TODO: support rewrite by record to break the original row groups into reasonable ones.
See
ParquetRewriterfor more details.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFiles- list of input file paths to read fromoutputFile- output file path to rewrite to
-
Builder
public Builder(org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.fs.Path> inputFiles, List<org.apache.hadoop.fs.Path> inputFilesToJoin, org.apache.hadoop.fs.Path outputFile) Create a builder to create a RewriterOptions.Please note the schema of all files in each file group
inputFilesandinputFilesToJoinmust be the same while those two schemas can be different in comparison with each other. Otherwise, the rewrite will fail.The rewrite will keep original row groups from all input files. This may not be optimal if row groups are very small and will not solve small file problems. Instead, it will make it worse to have a large file footer in the output file. TODO: support rewrite by record to break the original row groups into reasonable ones.
See
ParquetRewriterfor more details.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFiles- list of input file paths to read frominputFilesToJoin- list of input join file paths to read fromoutputFile- output file path to rewrite to
-
Builder
public Builder(org.apache.parquet.conf.ParquetConfiguration conf, List<org.apache.parquet.io.InputFile> inputFiles, List<org.apache.parquet.io.InputFile> inputFilesToJoin, org.apache.parquet.io.OutputFile outputFile) Create a builder to create a RewriterOptions.Please note the schema of all files in each file group
inputFilesandinputFilesToJoinmust be the same while those two schemas can be different in comparison with each other. Otherwise, the rewrite will fail.The rewrite will keep original row groups from all input files. This may not be optimal if row groups are very small and will not solve small file problems. Instead, it will make it worse to have a large file footer in the output file.
See
ParquetRewriterfor more details.- Parameters:
conf- configuration for reading from input files and writing to output fileinputFiles- list of input file paths to read frominputFilesToJoin- list of input join file paths to read fromoutputFile- output file path to rewrite to
-
-
Method Details
-
prune
Set the columns to prune.By default, all columns are kept.
- Parameters:
columns- list of columns to prune- Returns:
- self
-
transform
public RewriteOptions.Builder transform(org.apache.parquet.hadoop.metadata.CompressionCodecName newCodecName) Set the compression codec to use for the output file.By default, the codec is the same as the input file.
- Parameters:
newCodecName- compression codec to use- Returns:
- self
-
mask
Set the columns to mask.By default, no columns are masked.
- Parameters:
maskColumns- map of columns to mask to the masking mode- Returns:
- self
-
renameColumns
Set the columns to be renamed.Note that nested columns can't be renamed, in case of GroupType column only top level column can be renamed.
- Parameters:
renameColumns- map where keys are original names and values are new names- Returns:
- self
-
encrypt
Set the columns to encrypt.By default, no columns are encrypted.
- Parameters:
encryptColumns- list of columns to encrypt- Returns:
- self
-
encryptionProperties
public RewriteOptions.Builder encryptionProperties(FileEncryptionProperties fileEncryptionProperties) Set the encryption properties to use for the output file.This is required if encrypting columns are not empty.
- Parameters:
fileEncryptionProperties- encryption properties to use- Returns:
- self
-
addInputFile
Add an input file to read from.- Parameters:
path- input file path to read from- Returns:
- self
-
addInputFileToJoinColumns
Add an input join file to read from.- Parameters:
path- input file path to read from- Returns:
- self
-
addInputFile
Add an input file to read from.- Parameters:
inputFile- input file to read from- Returns:
- self
-
addInputFilesToJoin
Add an input file to join.- Parameters:
fileToJoin- input file to join- Returns:
- self
-
indexCacheStrategy
Set the index(ColumnIndex, Offset and BloomFilter) cache strategy.This could reduce the random seek while rewriting with PREFETCH_BLOCK strategy, NONE by default.
- Parameters:
cacheStrategy- the index cache strategy, supports:IndexCache.CacheStrategy.NONEorIndexCache.CacheStrategy.PREFETCH_BLOCK- Returns:
- self
-
overwriteInputWithJoinColumns
Set a flag whether columns from join files need to overwrite columns from the main input files.By default, join files columns do not overwrite the main input file columns.
- Parameters:
overwriteInputWithJoinColumns- a flag if columns from join files should overwrite columns from the main input files- Returns:
- self
-
ignoreJoinFilesMetadata
Set a flag whether metadata from join files should be ignored.By default, metadata is not ignored.
- Parameters:
ignoreJoinFilesMetadata- a flag if metadata from join files should be ignored- Returns:
- self
-
build
Build the RewriterOptions.- Returns:
- a RewriterOptions
-