public class FromElementsSource<OUT> extends Object implements Source<OUT,FromElementsSplit,NoOpEnumState>
Source
implementation that reads data from a list and stops reading at the fixed
position. The source will wait until the checkpoint or savepoint triggered, the source is useful
for connector tests.
Note: This parallelism of source must be 1.
Constructor and Description |
---|
FromElementsSource(Boundedness boundedness,
List<OUT> elements,
Integer emittedElementsNum) |
FromElementsSource(List<OUT> elements) |
Modifier and Type | Method and Description |
---|---|
SplitEnumerator<FromElementsSplit,NoOpEnumState> |
createEnumerator(SplitEnumeratorContext<FromElementsSplit> enumContext)
Creates a new SplitEnumerator for this source, starting a new input.
|
SourceReader<OUT,FromElementsSplit> |
createReader(SourceReaderContext readerContext)
Creates a new reader to read data from the splits it gets assigned.
|
Boundedness |
getBoundedness()
Get the boundedness of this source.
|
SimpleVersionedSerializer<NoOpEnumState> |
getEnumeratorCheckpointSerializer()
Creates the serializer for the
SplitEnumerator checkpoint. |
SimpleVersionedSerializer<FromElementsSplit> |
getSplitSerializer()
Creates a serializer for the source splits.
|
SplitEnumerator<FromElementsSplit,NoOpEnumState> |
restoreEnumerator(SplitEnumeratorContext<FromElementsSplit> enumContext,
NoOpEnumState checkpoint)
Restores an enumerator from a checkpoint.
|
public FromElementsSource(Boundedness boundedness, List<OUT> elements, Integer emittedElementsNum)
public Boundedness getBoundedness()
Source
getBoundedness
in interface Source<OUT,FromElementsSplit,NoOpEnumState>
public SourceReader<OUT,FromElementsSplit> createReader(SourceReaderContext readerContext) throws Exception
SourceReaderFactory
createReader
in interface SourceReaderFactory<OUT,FromElementsSplit>
readerContext
- The context
for the source reader.Exception
- The implementor is free to forward all exceptions directly. Exceptions
thrown from this method cause task failure/recovery.public SplitEnumerator<FromElementsSplit,NoOpEnumState> createEnumerator(SplitEnumeratorContext<FromElementsSplit> enumContext) throws Exception
Source
createEnumerator
in interface Source<OUT,FromElementsSplit,NoOpEnumState>
enumContext
- The context
for the split enumerator.Exception
- The implementor is free to forward all exceptions directly. Exceptions
thrown from this method cause JobManager failure/recovery.public SplitEnumerator<FromElementsSplit,NoOpEnumState> restoreEnumerator(SplitEnumeratorContext<FromElementsSplit> enumContext, NoOpEnumState checkpoint) throws Exception
Source
restoreEnumerator
in interface Source<OUT,FromElementsSplit,NoOpEnumState>
enumContext
- The context
for the restored split
enumerator.checkpoint
- The checkpoint to restore the SplitEnumerator from.Exception
- The implementor is free to forward all exceptions directly. Exceptions
thrown from this method cause JobManager failure/recovery.public SimpleVersionedSerializer<FromElementsSplit> getSplitSerializer()
Source
getSplitSerializer
in interface Source<OUT,FromElementsSplit,NoOpEnumState>
public SimpleVersionedSerializer<NoOpEnumState> getEnumeratorCheckpointSerializer()
Source
SplitEnumerator
checkpoint. The serializer is used for
the result of the SplitEnumerator.snapshotState(long)
method.getEnumeratorCheckpointSerializer
in interface Source<OUT,FromElementsSplit,NoOpEnumState>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.