public class AvroInputFormat<E> extends FileInputFormat<E> implements ResultTypeQueryable<E>
FileInputFormat.FileBaseStatistics, FileInputFormat.InputSplitOpenThread
currentSplit, 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 |
---|---|
TypeInformation<E> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
E |
nextRecord(E reuseValue)
Reads the next record from the input.
|
void |
open(FileInputSplit split)
Opens an input stream to the file defined in the input format.
|
boolean |
reachedEnd()
Method used to check if the end of the input is reached.
|
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, getNumSplits, getOpenTimeout, getSplitLength, getSplitStart, getStatistics, registerInflaterInputStreamFactory, setFilePath, setFilePath, setMinSplitSize, setNumSplits, setOpenTimeout, testForUnsplittable, toString
getRuntimeContext, setRuntimeContext
public 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()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<E>
public void open(FileInputSplit split) throws IOException
FileInputFormat
The stream is actually opened in an asynchronous thread to make sure any interruptions to the thread working on the input format do not reach the file system.
open
in interface InputFormat<E,FileInputSplit>
open
in class FileInputFormat<E>
split
- The split to be opened.IOException
- Thrown, if the spit could not be opened due to an I/O problem.public boolean reachedEnd() throws IOException
InputFormat
When this method is called, the input format it guaranteed to be opened.
reachedEnd
in interface InputFormat<E,FileInputSplit>
IOException
- Thrown, if an I/O error occurred.public E nextRecord(E reuseValue) throws IOException
InputFormat
When this method is called, the input format it guaranteed to be opened.
nextRecord
in interface InputFormat<E,FileInputSplit>
reuseValue
- Object that may be reused.IOException
- Thrown, if an I/O error occurred.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.