T
- Type of records read by the source.public abstract class BoundedSource<T> extends Source<T>
Source
that reads a finite amount of input and, because of that, supports
some additional operations.
The operations are:
split(long, org.apache.beam.sdk.options.PipelineOptions)
;
getEstimatedSizeBytes(org.apache.beam.sdk.options.PipelineOptions)
;
reader
has additional functionality to enable runners
to dynamically adapt based on runtime conditions.
BoundedSource.BoundedReader.getFractionConsumed()
)
BoundedSource.BoundedReader.getSplitPointsConsumed()
and
BoundedSource.BoundedReader.getSplitPointsRemaining()
).
BoundedSource.BoundedReader.splitAtFraction(double)
).
Modifier and Type | Class and Description |
---|---|
static class |
BoundedSource.BoundedReader<T>
A
Reader that reads a bounded amount of input and supports some additional
operations, such as progress estimation and dynamic work rebalancing. |
Source.Reader<T>
Constructor and Description |
---|
BoundedSource() |
Modifier and Type | Method and Description |
---|---|
abstract BoundedSource.BoundedReader<T> |
createReader(PipelineOptions options)
Returns a new
BoundedSource.BoundedReader that reads from this source. |
abstract long |
getEstimatedSizeBytes(PipelineOptions options)
An estimate of the total size (in bytes) of the data that would be read from this source.
|
abstract java.util.List<? extends BoundedSource<T>> |
split(long desiredBundleSizeBytes,
PipelineOptions options)
Splits the source into bundles of approximately
desiredBundleSizeBytes . |
getDefaultOutputCoder, populateDisplayData, validate
public abstract java.util.List<? extends BoundedSource<T>> split(long desiredBundleSizeBytes, PipelineOptions options) throws java.lang.Exception
desiredBundleSizeBytes
.java.lang.Exception
public abstract long getEstimatedSizeBytes(PipelineOptions options) throws java.lang.Exception
If there is no way to estimate the size of the source implementations MAY return 0L.
java.lang.Exception
public abstract BoundedSource.BoundedReader<T> createReader(PipelineOptions options) throws java.io.IOException
BoundedSource.BoundedReader
that reads from this source.java.io.IOException