Class FileSourceReader<T,SplitT extends FileSourceSplit>
- java.lang.Object
-
- org.apache.flink.connector.base.source.reader.SourceReaderBase<E,T,SplitT,SplitStateT>
-
- org.apache.flink.connector.base.source.reader.SingleThreadMultiplexSourceReaderBase<RecordAndPosition<T>,T,SplitT,FileSourceSplitState<SplitT>>
-
- org.apache.flink.connector.file.src.impl.FileSourceReader<T,SplitT>
-
- All Implemented Interfaces:
AutoCloseable
,CheckpointListener
,SourceReader<T,SplitT>
@Internal public final class FileSourceReader<T,SplitT extends FileSourceSplit> extends SingleThreadMultiplexSourceReaderBase<RecordAndPosition<T>,T,SplitT,FileSourceSplitState<SplitT>>
ASourceReader
that read records fromFileSourceSplit
.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.connector.base.source.reader.SourceReaderBase
config, context, eofRecordEvaluator, options, recordEmitter, splitFetcherManager
-
-
Constructor Summary
Constructors Constructor Description FileSourceReader(SourceReaderContext readerContext, BulkFormat<T,SplitT> readerFormat, Configuration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FileSourceSplitState<SplitT>
initializedState(SplitT split)
When new splits are added to the reader.protected void
onSplitFinished(Map<String,FileSourceSplitState<SplitT>> finishedSplitIds)
Handles the finished splits to clean the state if needed.void
start()
Start the reader.protected SplitT
toSplitType(String splitId, FileSourceSplitState<SplitT> splitState)
Convert a mutable SplitStateT to immutable SplitT.-
Methods inherited from class org.apache.flink.connector.base.source.reader.SourceReaderBase
addSplits, close, getNumberOfCurrentlyAssignedSplits, handleSourceEvents, isAvailable, notifyNoMoreSplits, pauseOrResumeSplits, pollNext, snapshotState
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.state.CheckpointListener
notifyCheckpointAborted
-
Methods inherited from interface org.apache.flink.api.connector.source.SourceReader
notifyCheckpointComplete
-
-
-
-
Constructor Detail
-
FileSourceReader
public FileSourceReader(SourceReaderContext readerContext, BulkFormat<T,SplitT> readerFormat, Configuration config)
-
-
Method Detail
-
start
public void start()
Description copied from interface:SourceReader
Start the reader.- Specified by:
start
in interfaceSourceReader<T,SplitT extends FileSourceSplit>
- Overrides:
start
in classSourceReaderBase<RecordAndPosition<T>,T,SplitT extends FileSourceSplit,FileSourceSplitState<SplitT extends FileSourceSplit>>
-
onSplitFinished
protected void onSplitFinished(Map<String,FileSourceSplitState<SplitT>> finishedSplitIds)
Description copied from class:SourceReaderBase
Handles the finished splits to clean the state if needed.- Specified by:
onSplitFinished
in classSourceReaderBase<RecordAndPosition<T>,T,SplitT extends FileSourceSplit,FileSourceSplitState<SplitT extends FileSourceSplit>>
-
initializedState
protected FileSourceSplitState<SplitT> initializedState(SplitT split)
Description copied from class:SourceReaderBase
When new splits are added to the reader. The initialize the state of the new splits.- Specified by:
initializedState
in classSourceReaderBase<RecordAndPosition<T>,T,SplitT extends FileSourceSplit,FileSourceSplitState<SplitT extends FileSourceSplit>>
- Parameters:
split
- a newly added split.
-
toSplitType
protected SplitT toSplitType(String splitId, FileSourceSplitState<SplitT> splitState)
Description copied from class:SourceReaderBase
Convert a mutable SplitStateT to immutable SplitT.- Specified by:
toSplitType
in classSourceReaderBase<RecordAndPosition<T>,T,SplitT extends FileSourceSplit,FileSourceSplitState<SplitT extends FileSourceSplit>>
splitState
- splitState.- Returns:
- an immutable Split state.
-
-