Package org.apache.flink.formats.avro
Class AvroInputFormat<E>
java.lang.Object
org.apache.flink.api.common.io.RichInputFormat<OT,org.apache.flink.core.fs.FileInputSplit>
org.apache.flink.api.common.io.FileInputFormat<E>
org.apache.flink.formats.avro.AvroInputFormat<E>
- Type Parameters:
E- the type of the result Avro record. If you specifyGenericRecordthen the result will be returned as aGenericRecord, so you do not have to know the schema ahead of time.
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.io.CheckpointableInputFormat<org.apache.flink.core.fs.FileInputSplit,,org.apache.flink.api.java.tuple.Tuple2<Long, Long>> org.apache.flink.api.common.io.InputFormat<E,,org.apache.flink.core.fs.FileInputSplit> org.apache.flink.api.java.typeutils.ResultTypeQueryable<E>,org.apache.flink.core.io.InputSplitSource<org.apache.flink.core.fs.FileInputSplit>
public class AvroInputFormat<E>
extends org.apache.flink.api.common.io.FileInputFormat<E>
implements org.apache.flink.api.java.typeutils.ResultTypeQueryable<E>, org.apache.flink.api.common.io.CheckpointableInputFormat<org.apache.flink.core.fs.FileInputSplit,org.apache.flink.api.java.tuple.Tuple2<Long,Long>>
Provides a
FileInputFormat for Avro records.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.api.common.io.FileInputFormat
org.apache.flink.api.common.io.FileInputFormat.FileBaseStatistics, org.apache.flink.api.common.io.FileInputFormat.InputSplitOpenThread -
Field Summary
Fields inherited from class org.apache.flink.api.common.io.FileInputFormat
currentSplit, enumerateNestedFiles, INFLATER_INPUT_STREAM_FACTORIES, minSplitSize, numSplits, openTimeout, READ_WHOLE_SPLIT_FLAG, splitLength, splitStart, stream, unsplittable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.flink.api.common.typeinfo.TypeInformation<E>longnextRecord(E reuseValue) voidopen(org.apache.flink.core.fs.FileInputSplit split) booleanvoidreopen(org.apache.flink.core.fs.FileInputSplit split, org.apache.flink.api.java.tuple.Tuple2<Long, Long> state) voidsetReuseAvroValue(boolean reuseAvroValue) Sets the flag whether to reuse the Avro value instance for all records.voidsetUnsplittable(boolean unsplittable) If set, the InputFormat will only read entire files.Methods inherited from class org.apache.flink.api.common.io.FileInputFormat
acceptFile, close, configure, createInputSplits, decorateInputStream, extractFileExtension, getFilePaths, getFileStats, getFileStats, getInflaterInputStreamFactory, getInputSplitAssigner, getMinSplitSize, getNestedFileEnumeration, getNumSplits, getOpenTimeout, getSplitLength, getSplitStart, getStatistics, getSupportedCompressionFormats, registerInflaterInputStreamFactory, setFilePath, setFilePath, setFilePaths, setFilePaths, setFilesFilter, setMinSplitSize, setNestedFileEnumeration, setNumSplits, setOpenTimeout, testForUnsplittable, toStringMethods inherited from class org.apache.flink.api.common.io.RichInputFormat
closeInputFormat, getRuntimeContext, openInputFormat, setRuntimeContext
-
Constructor Details
-
AvroInputFormat
-
-
Method Details
-
setReuseAvroValue
public void setReuseAvroValue(boolean reuseAvroValue) Sets the flag whether to reuse the Avro value instance for all records. By default, the input format reuses the Avro value.- Parameters:
reuseAvroValue- True, if the input format should reuse the Avro value instance, false otherwise.
-
setUnsplittable
public void setUnsplittable(boolean unsplittable) If set, the InputFormat will only read entire files. -
getProducedType
- Specified by:
getProducedTypein interfaceorg.apache.flink.api.java.typeutils.ResultTypeQueryable<E>
-
open
- Specified by:
openin interfaceorg.apache.flink.api.common.io.InputFormat<E,org.apache.flink.core.fs.FileInputSplit> - Overrides:
openin classorg.apache.flink.api.common.io.FileInputFormat<E>- Throws:
IOException
-
reachedEnd
- Specified by:
reachedEndin interfaceorg.apache.flink.api.common.io.InputFormat<E,org.apache.flink.core.fs.FileInputSplit> - Throws:
IOException
-
getRecordsReadFromBlock
public long getRecordsReadFromBlock() -
nextRecord
- Specified by:
nextRecordin interfaceorg.apache.flink.api.common.io.InputFormat<E,org.apache.flink.core.fs.FileInputSplit> - Throws:
IOException
-
getCurrentState
- Specified by:
getCurrentStatein interfaceorg.apache.flink.api.common.io.CheckpointableInputFormat<org.apache.flink.core.fs.FileInputSplit,org.apache.flink.api.java.tuple.Tuple2<Long, Long>> - Throws:
IOException
-
reopen
public void reopen(org.apache.flink.core.fs.FileInputSplit split, org.apache.flink.api.java.tuple.Tuple2<Long, Long> state) throws IOException- Specified by:
reopenin interfaceorg.apache.flink.api.common.io.CheckpointableInputFormat<org.apache.flink.core.fs.FileInputSplit,org.apache.flink.api.java.tuple.Tuple2<Long, Long>> - Throws:
IOException
-