Package org.apache.parquet.hadoop
Class ParquetInputFormat<T>
java.lang.Object
org.apache.hadoop.mapreduce.InputFormat<K,V>
org.apache.hadoop.mapreduce.lib.input.FileInputFormat<Void,T>
org.apache.parquet.hadoop.ParquetInputFormat<T>
- Type Parameters:
T- the type of the materialized records
- Direct Known Subclasses:
ExampleInputFormat
public class ParquetInputFormat<T>
extends org.apache.hadoop.mapreduce.lib.input.FileInputFormat<Void,T>
The input format to read a Parquet file.
It requires an implementation of ReadSupport to materialize the records.
The requestedSchema will control how the original records get projected by the loader. It must be a subset of the original schema. Only the columns needed to reconstruct the records with the requestedSchema will be scanned.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat
org.apache.hadoop.mapreduce.lib.input.FileInputFormat.Counter -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringkey to configure whether row group bloom filtering is enabledstatic final Stringkey to configure whether column index filtering of pages is enabledstatic final Stringkey to configure whether row group dictionary filtering is enabledstatic final Stringkey to configure the filter predicatestatic final booleanDefault value of parquet.hadoop.vectored.io.enabled is true.static final StringKey to enable/disable vectored io while reading parquet files: "parquet.hadoop.vectored.io.enabled".static final StringKey to configure if off-heap buffer should be used for decryptionstatic final Stringkey to configure whether page level checksum verification is enabledstatic final Stringkey to configure the ReadSupport implementationstatic final Stringkey to configure whether record-level filtering is enabledstatic final Stringkey to turn off file splitting.static final Stringkey to configure whether row group stats filtering is enabledstatic final Stringkey to configure type checking for conflicting schemas (default: true)static final Stringkey to turn on or off task side metadata loading (default true) if true then metadata is read on the task side and some tasks may finish immediately.static final Stringkey to configure the filterFields inherited from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat
DEFAULT_LIST_STATUS_NUM_THREADS, INPUT_DIR, INPUT_DIR_NONRECURSIVE_IGNORE_SUBDIRS, INPUT_DIR_RECURSIVE, LIST_STATUS_NUM_THREADS, NUM_INPUT_FILES, PATHFILTER_CLASS, SPLIT_MAXSIZE, SPLIT_MINSIZE -
Constructor Summary
ConstructorsConstructorDescriptionHadoop will instantiate using this constructorParquetInputFormat(Class<S> readSupportClass) Constructor for subclasses, such as AvroParquetInputFormat, or wrappers. -
Method Summary
Modifier and TypeMethodDescriptioncreateRecordReader(org.apache.hadoop.mapreduce.InputSplit inputSplit, org.apache.hadoop.mapreduce.TaskAttemptContext taskAttemptContext) static org.apache.parquet.filter2.compat.FilterCompat.FiltergetFilter(org.apache.hadoop.conf.Configuration conf) Returns a non-null Filter, which is a wrapper around either a FilterPredicate, an UnboundRecordFilter, or a no-op filter.static org.apache.parquet.filter2.compat.FilterCompat.FiltergetFilter(org.apache.parquet.conf.ParquetConfiguration conf) getFooters(org.apache.hadoop.conf.Configuration configuration, Collection<org.apache.hadoop.fs.FileStatus> statuses) the footers for the filesgetFooters(org.apache.hadoop.conf.Configuration configuration, List<org.apache.hadoop.fs.FileStatus> statuses) getFooters(org.apache.hadoop.mapreduce.JobContext jobContext) getGlobalMetaData(org.apache.hadoop.mapreduce.JobContext jobContext) static Class<?>getReadSupportClass(org.apache.hadoop.conf.Configuration configuration) static <T> ReadSupport<T>getReadSupportInstance(org.apache.hadoop.conf.Configuration configuration) Deprecated.split planning using file footers will be removedList<org.apache.hadoop.mapreduce.InputSplit>getSplits(org.apache.hadoop.mapreduce.JobContext jobContext) static Class<?>getUnboundRecordFilter(org.apache.hadoop.conf.Configuration configuration) Deprecated.protected booleanisSplitable(org.apache.hadoop.mapreduce.JobContext context, org.apache.hadoop.fs.Path filename) static booleanisTaskSideMetaData(org.apache.hadoop.conf.Configuration configuration) protected List<org.apache.hadoop.fs.FileStatus>listStatus(org.apache.hadoop.mapreduce.JobContext jobContext) static voidsetFilterPredicate(org.apache.hadoop.conf.Configuration configuration, org.apache.parquet.filter2.predicate.FilterPredicate filterPredicate) static voidsetReadSupportClass(org.apache.hadoop.mapred.JobConf conf, Class<?> readSupportClass) static voidsetReadSupportClass(org.apache.hadoop.mapreduce.Job job, Class<?> readSupportClass) static voidsetTaskSideMetaData(org.apache.hadoop.mapreduce.Job job, boolean taskSideMetadata) static voidsetUnboundRecordFilter(org.apache.hadoop.mapreduce.Job job, Class<? extends org.apache.parquet.filter.UnboundRecordFilter> filterClass) Methods inherited from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat
addInputPath, addInputPathRecursively, addInputPaths, computeSplitSize, getBlockIndex, getFormatMinSplitSize, getInputDirRecursive, getInputPathFilter, getInputPaths, getMaxSplitSize, getMinSplitSize, makeSplit, makeSplit, setInputDirRecursive, setInputPathFilter, setInputPaths, setInputPaths, setMaxInputSplitSize, setMinInputSplitSize
-
Field Details
-
READ_SUPPORT_CLASS
key to configure the ReadSupport implementation- See Also:
-
UNBOUND_RECORD_FILTER
key to configure the filter- See Also:
-
STRICT_TYPE_CHECKING
key to configure type checking for conflicting schemas (default: true)- See Also:
-
FILTER_PREDICATE
key to configure the filter predicate- See Also:
-
RECORD_FILTERING_ENABLED
key to configure whether record-level filtering is enabled- See Also:
-
STATS_FILTERING_ENABLED
key to configure whether row group stats filtering is enabled- See Also:
-
DICTIONARY_FILTERING_ENABLED
key to configure whether row group dictionary filtering is enabled- See Also:
-
COLUMN_INDEX_FILTERING_ENABLED
key to configure whether column index filtering of pages is enabled- See Also:
-
PAGE_VERIFY_CHECKSUM_ENABLED
key to configure whether page level checksum verification is enabled- See Also:
-
BLOOM_FILTERING_ENABLED
key to configure whether row group bloom filtering is enabled- See Also:
-
OFF_HEAP_DECRYPT_BUFFER_ENABLED
Key to configure if off-heap buffer should be used for decryption- See Also:
-
TASK_SIDE_METADATA
key to turn on or off task side metadata loading (default true) if true then metadata is read on the task side and some tasks may finish immediately. if false metadata is read on the client which is slower if there is a lot of metadata but tasks will only be spawn if there is work to do.- See Also:
-
SPLIT_FILES
key to turn off file splitting. See PARQUET-246.- See Also:
-
HADOOP_VECTORED_IO_ENABLED
Key to enable/disable vectored io while reading parquet files: "parquet.hadoop.vectored.io.enabled".- See Also:
-
HADOOP_VECTORED_IO_DEFAULT
public static final boolean HADOOP_VECTORED_IO_DEFAULTDefault value of parquet.hadoop.vectored.io.enabled is true.- See Also:
-
-
Constructor Details
-
ParquetInputFormat
public ParquetInputFormat()Hadoop will instantiate using this constructor -
ParquetInputFormat
Constructor for subclasses, such as AvroParquetInputFormat, or wrappers.Subclasses and wrappers may use this constructor to set the ReadSupport class that will be used when reading instead of requiring the user to set the read support property in their configuration.
- Type Parameters:
S- the Java read support type- Parameters:
readSupportClass- a ReadSupport subclass
-
-
Method Details
-
setTaskSideMetaData
public static void setTaskSideMetaData(org.apache.hadoop.mapreduce.Job job, boolean taskSideMetadata) -
isTaskSideMetaData
public static boolean isTaskSideMetaData(org.apache.hadoop.conf.Configuration configuration) -
setReadSupportClass
public static void setReadSupportClass(org.apache.hadoop.mapreduce.Job job, Class<?> readSupportClass) -
setUnboundRecordFilter
public static void setUnboundRecordFilter(org.apache.hadoop.mapreduce.Job job, Class<? extends org.apache.parquet.filter.UnboundRecordFilter> filterClass) -
getUnboundRecordFilter
@Deprecated public static Class<?> getUnboundRecordFilter(org.apache.hadoop.conf.Configuration configuration) Deprecated.- Parameters:
configuration- a configuration- Returns:
- an unbound record filter class
-
setReadSupportClass
public static void setReadSupportClass(org.apache.hadoop.mapred.JobConf conf, Class<?> readSupportClass) -
getReadSupportClass
-
setFilterPredicate
public static void setFilterPredicate(org.apache.hadoop.conf.Configuration configuration, org.apache.parquet.filter2.predicate.FilterPredicate filterPredicate) -
getFilter
public static org.apache.parquet.filter2.compat.FilterCompat.Filter getFilter(org.apache.hadoop.conf.Configuration conf) Returns a non-null Filter, which is a wrapper around either a FilterPredicate, an UnboundRecordFilter, or a no-op filter.- Parameters:
conf- a configuration- Returns:
- a filter for the unbound record filter specified in conf
-
getFilter
public static org.apache.parquet.filter2.compat.FilterCompat.Filter getFilter(org.apache.parquet.conf.ParquetConfiguration conf) -
createRecordReader
public org.apache.hadoop.mapreduce.RecordReader<Void,T> createRecordReader(org.apache.hadoop.mapreduce.InputSplit inputSplit, org.apache.hadoop.mapreduce.TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException - Specified by:
createRecordReaderin classorg.apache.hadoop.mapreduce.InputFormat<Void,T> - Throws:
IOExceptionInterruptedException
-
getReadSupportInstance
public static <T> ReadSupport<T> getReadSupportInstance(org.apache.hadoop.conf.Configuration configuration) - Type Parameters:
T- the Java type of objects created by the ReadSupport- Parameters:
configuration- to find the configuration for the read support- Returns:
- the configured read support
-
isSplitable
protected boolean isSplitable(org.apache.hadoop.mapreduce.JobContext context, org.apache.hadoop.fs.Path filename) -
getSplits
public List<org.apache.hadoop.mapreduce.InputSplit> getSplits(org.apache.hadoop.mapreduce.JobContext jobContext) throws IOException - Overrides:
getSplitsin classorg.apache.hadoop.mapreduce.lib.input.FileInputFormat<Void,T> - Throws:
IOException
-
getSplits
@Deprecated public List<ParquetInputSplit> getSplits(org.apache.hadoop.conf.Configuration configuration, List<Footer> footers) throws IOException Deprecated.split planning using file footers will be removed- Parameters:
configuration- the configuration to connect to the file systemfooters- the footers of the files to read- Returns:
- the splits for the footers
- Throws:
IOException- if there is an error while reading
-
listStatus
protected List<org.apache.hadoop.fs.FileStatus> listStatus(org.apache.hadoop.mapreduce.JobContext jobContext) throws IOException - Overrides:
listStatusin classorg.apache.hadoop.mapreduce.lib.input.FileInputFormat<Void,T> - Throws:
IOException
-
getGlobalMetaData
public GlobalMetaData getGlobalMetaData(org.apache.hadoop.mapreduce.JobContext jobContext) throws IOException - Parameters:
jobContext- the current job context- Returns:
- the merged metadata from the footers
- Throws:
IOException- if there is an error while reading
-