Class TestStream<T>
- All Implemented Interfaces:
Serializable,HasDisplayData
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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn incompleteTestStream.static classATestStream.Eventthat produces elements.static interfaceAn event in aTestStream.static enumThe types ofTestStream.Eventthat are supported byTestStream.static classATestStream.Eventthat advances the processing time clock.static classCoder forTestStream.static classATestStream.Eventthat advances the watermark. -
Field Summary
Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TestStream.Builder<T> Create a newTestStream.Builderwith no elements and watermark equal toBoundedWindow.TIMESTAMP_MIN_VALUE.static TestStream.Builder<Row> static <T> TestStream.Builder<T> create(Schema schema, TypeDescriptor<T> typeDescriptor, SerializableFunction<T, Row> toRowFunction, SerializableFunction<Row, T> fromRowFunction) booleanOverride this method to specify how thisPTransformshould be expanded on the givenInputT.static <T> TestStream<T> fromRawEvents(Coder<T> coder, List<TestStream.Event<T>> events) For internal use only.Returns the sequence ofEventsin thisTestStream.inthashCode()Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
-
Method Details
-
create
Create a newTestStream.Builderwith no elements and watermark equal toBoundedWindow.TIMESTAMP_MIN_VALUE. -
create
-
create
public static <T> TestStream.Builder<T> create(Schema schema, TypeDescriptor<T> typeDescriptor, SerializableFunction<T, Row> toRowFunction, SerializableFunction<Row, T> fromRowFunction) -
expand
Description copied from class:PTransformOverride this method to specify how thisPTransformshould be expanded on the givenInputT.NOTE: This method should not be called directly. Instead apply the
PTransformshould be applied to theInputTusing theapplymethod.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).
- Specified by:
expandin classPTransform<PBegin,PCollection<T>>
-
getValueCoder
-
getEvents
-
fromRawEvents
@Internal public static <T> TestStream<T> fromRawEvents(Coder<T> coder, List<TestStream.Event<T>> events) For internal use only. No backwards-compatibility guarantees.Builder a test stream directly from events. No validation is performed on watermark monotonicity, etc. This is assumed to be a previously-serialized
TestStreamtransform that is correct by construction. -
equals
-
hashCode
public int hashCode()
-