E - the type of the result Avro record. If you specify
GenericRecord then the result will be returned as a
GenericRecord, so you do not have to know the schema ahead
of time.public class AvroInputFormat<E> extends FileInputFormat<E> implements ResultTypeQueryable<E>, CheckpointableInputFormat<FileInputSplit,Tuple2<Long,Long>>
FileInputFormat for Avro records.FileInputFormat.FileBaseStatistics, FileInputFormat.InputSplitOpenThreadcurrentSplit, ENUMERATE_NESTED_FILES_FLAG, enumerateNestedFiles, filePath, INFLATER_INPUT_STREAM_FACTORIES, minSplitSize, numSplits, openTimeout, READ_WHOLE_SPLIT_FLAG, splitLength, splitStart, stream, unsplittable| Constructor and Description |
|---|
AvroInputFormat(Path filePath,
Class<E> type) |
| Modifier and Type | Method and Description |
|---|---|
Tuple2<Long,Long> |
getCurrentState() |
TypeInformation<E> |
getProducedType() |
long |
getRecordsReadFromBlock() |
E |
nextRecord(E reuseValue) |
void |
open(FileInputSplit split) |
boolean |
reachedEnd() |
void |
reopen(FileInputSplit split,
Tuple2<Long,Long> state) |
void |
setReuseAvroValue(boolean reuseAvroValue)
Sets the flag whether to reuse the Avro value instance for all records.
|
void |
setUnsplittable(boolean unsplittable)
If set, the InputFormat will only read entire files.
|
acceptFile, close, configure, createInputSplits, decorateInputStream, extractFileExtension, getFilePath, getFileStats, getInflaterInputStreamFactory, getInputSplitAssigner, getMinSplitSize, getNestedFileEnumeration, getNumSplits, getOpenTimeout, getSplitLength, getSplitStart, getStatistics, registerInflaterInputStreamFactory, setFilePath, setFilePath, setFilesFilter, setMinSplitSize, setNestedFileEnumeration, setNumSplits, setOpenTimeout, testForUnsplittable, toStringcloseInputFormat, getRuntimeContext, openInputFormat, setRuntimeContextpublic void setReuseAvroValue(boolean reuseAvroValue)
reuseAvroValue - True, if the input format should reuse the Avro value instance, false otherwise.public void setUnsplittable(boolean unsplittable)
public TypeInformation<E> getProducedType()
getProducedType in interface ResultTypeQueryable<E>public void open(FileInputSplit split) throws IOException
open in interface InputFormat<E,FileInputSplit>open in class FileInputFormat<E>IOExceptionpublic boolean reachedEnd()
throws IOException
reachedEnd in interface InputFormat<E,FileInputSplit>IOExceptionpublic long getRecordsReadFromBlock()
public E nextRecord(E reuseValue) throws IOException
nextRecord in interface InputFormat<E,FileInputSplit>IOExceptionpublic Tuple2<Long,Long> getCurrentState() throws IOException
getCurrentState in interface CheckpointableInputFormat<FileInputSplit,Tuple2<Long,Long>>IOExceptionpublic void reopen(FileInputSplit split, Tuple2<Long,Long> state) throws IOException
reopen in interface CheckpointableInputFormat<FileInputSplit,Tuple2<Long,Long>>IOExceptionCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.