public final class TestStream<T> extends PTransform<PBegin,PCollection<T>>
PCollection
of elements, advancing the
watermark and processing time as elements are emitted. After all of the specified elements are
emitted, ceases to produce output.
Each call to a TestStream.Builder
method will only be reflected in the state of the
Pipeline
after each method before it has completed and no more progress can be made by
the Pipeline
. A PipelineRunner
must ensure that no more progress can be made in
the Pipeline
before advancing the state of the TestStream
.
Modifier and Type | Class and Description |
---|---|
static class |
TestStream.Builder<T>
An incomplete
TestStream . |
static class |
TestStream.ElementEvent<T>
A
TestStream.Event that produces elements. |
static interface |
TestStream.Event<T>
An event in a
TestStream . |
static class |
TestStream.EventType
The types of
TestStream.Event that are supported by TestStream . |
static class |
TestStream.ProcessingTimeEvent<T>
A
TestStream.Event that advances the processing time clock. |
static class |
TestStream.WatermarkEvent<T>
A
TestStream.Event that advances the watermark. |
name
Modifier and Type | Method and Description |
---|---|
static <T> TestStream.Builder<T> |
create(Coder<T> coder)
Create a new
TestStream.Builder with no elements and watermark equal to BoundedWindow.TIMESTAMP_MIN_VALUE . |
static <T> TestStream.Builder<T> |
create(Schema schema,
SerializableFunction<T,Row> toRowFunction,
SerializableFunction<Row,T> fromRowFunction) |
boolean |
equals(java.lang.Object other) |
PCollection<T> |
expand(PBegin input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
static <T> TestStream<T> |
fromRawEvents(Coder<T> coder,
java.util.List<TestStream.Event<T>> events)
For internal use only.
|
java.util.List<TestStream.Event<T>> |
getEvents()
Returns the sequence of
Events in this TestStream . |
Coder<T> |
getValueCoder() |
int |
hashCode() |
getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate
public static <T> TestStream.Builder<T> create(Coder<T> coder)
TestStream.Builder
with no elements and watermark equal to BoundedWindow.TIMESTAMP_MIN_VALUE
.public static <T> TestStream.Builder<T> create(Schema schema, SerializableFunction<T,Row> toRowFunction, SerializableFunction<Row,T> fromRowFunction)
public PCollection<T> expand(PBegin input)
PTransform
PTransform
should be expanded on the given
InputT
.
NOTE: This method should not be called directly. Instead apply the PTransform
should
be applied to the InputT
using the apply
method.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
expand
in class PTransform<PBegin,PCollection<T>>
public java.util.List<TestStream.Event<T>> getEvents()
@Internal public static <T> TestStream<T> fromRawEvents(Coder<T> coder, java.util.List<TestStream.Event<T>> events)
Builder a test stream directly from events. No validation is performed on watermark
monotonicity, etc. This is assumed to be a previously-serialized TestStream
transform
that is correct by construction.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object