Package org.apache.beam.sdk.io
Class CountingSource.UnboundedCountingSource
java.lang.Object
org.apache.beam.sdk.io.Source<Long>
org.apache.beam.sdk.io.UnboundedSource<Long,CountingSource.CounterMark>
org.apache.beam.sdk.io.CountingSource.UnboundedCountingSource
- All Implemented Interfaces:
Serializable,HasDisplayData
- Enclosing class:
CountingSource
public static class CountingSource.UnboundedCountingSource
extends UnboundedSource<Long,CountingSource.CounterMark>
An implementation of
CountingSource that produces an unbounded PCollection.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.io.UnboundedSource
UnboundedSource.CheckpointMark, UnboundedSource.UnboundedReader<OutputT>Nested classes/interfaces inherited from class org.apache.beam.sdk.io.Source
Source.Reader<T> -
Method Summary
Modifier and TypeMethodDescriptioncreateReader(PipelineOptions options, CountingSource.CounterMark checkpointMark) Create a newUnboundedSource.UnboundedReaderto read from this source, resuming from the given checkpoint if present.booleanReturns aCoderfor encoding and decoding the checkpoints for this source.Returns theCoderto use for the data read from this source.inthashCode()List<? extends UnboundedSource<Long, CountingSource.CounterMark>> split(int desiredNumSplits, PipelineOptions options) Splits an unbounded sourcedesiredNumSplitsways by giving each split everydesiredNumSplitsth element that thisCountingSource.UnboundedCountingSourceproduces.to(long end) Returns anCountingSource.UnboundedCountingSourcelike this one but with the specified exclusive limit.Returns anCountingSource.UnboundedCountingSourcelike this one with the specified period.withTimestampFn(SerializableFunction<Long, Instant> timestampFn) Returns anCountingSource.UnboundedCountingSourcelike this one where the timestamp of output elements are supplied by the specified function.Methods inherited from class org.apache.beam.sdk.io.UnboundedSource
offsetBasedDeduplicationSupported, requiresDedupingMethods inherited from class org.apache.beam.sdk.io.Source
getDefaultOutputCoder, populateDisplayData, validate
-
Method Details
-
withRate
Returns anCountingSource.UnboundedCountingSourcelike this one with the specified period. Elements will be produced with an interval between them equal to the period. -
withTimestampFn
public CountingSource.UnboundedCountingSource withTimestampFn(SerializableFunction<Long, Instant> timestampFn) Returns anCountingSource.UnboundedCountingSourcelike this one where the timestamp of output elements are supplied by the specified function.Note that timestamps produced by
timestampFnmay not decrease. -
to
Returns anCountingSource.UnboundedCountingSourcelike this one but with the specified exclusive limit. -
split
public List<? extends UnboundedSource<Long,CountingSource.CounterMark>> split(int desiredNumSplits, PipelineOptions options) throws Exception Splits an unbounded sourcedesiredNumSplitsways by giving each split everydesiredNumSplitsth element that thisCountingSource.UnboundedCountingSourceproduces.E.g., if a source produces all even numbers
[0, 2, 4, 6, 8, ...)and we want to split into 3 new sources, then the new sources will produce numbers that are 6 apart and are offset at the start by the original stride:[0, 6, 12, ...),[2, 8, 14, ...), and[4, 10, 16, ...).- Specified by:
splitin classUnboundedSource<Long,CountingSource.CounterMark> - Throws:
Exception
-
createReader
public UnboundedSource.UnboundedReader<Long> createReader(PipelineOptions options, CountingSource.CounterMark checkpointMark) Description copied from class:UnboundedSourceCreate a newUnboundedSource.UnboundedReaderto read from this source, resuming from the given checkpoint if present.- Specified by:
createReaderin classUnboundedSource<Long,CountingSource.CounterMark>
-
getCheckpointMarkCoder
Description copied from class:UnboundedSourceReturns aCoderfor encoding and decoding the checkpoints for this source.- Specified by:
getCheckpointMarkCoderin classUnboundedSource<Long,CountingSource.CounterMark>
-
getOutputCoder
Description copied from class:SourceReturns theCoderto use for the data read from this source.- Overrides:
getOutputCoderin classSource<Long>
-
equals
-
hashCode
public int hashCode()
-