Class Tee<T>
- Type Parameters:
T
- the element type of the input PCollection
- All Implemented Interfaces:
Serializable
,HasDisplayData
tee
command, which is named after the T-splitter used in plumbing.
This can be useful to write out or otherwise process an intermediate transform without breaking the linear flow of a chain of transforms, e.g.
PCollection<T> input = ... ;
PCollection<T> result =
input.apply(...)
...
input.apply(Tee.of(someSideTransform)
...
input.apply(...);
- See Also:
-
Field Summary
Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints
-
Method Summary
Modifier and TypeMethodDescriptionexpand
(PCollection<T> input) Override this method to specify how thisPTransform
should be expanded on the givenInputT
.protected String
Returns the name to use by default for thisPTransform
(not including the names of any enclosingPTransform
s).static <T> Tee
<T> of
(Consumer<PCollection<T>> consumer) Returns a new Tee PTransform that will apply an auxilary transform to the input as well as pass it on.static <T> Tee
<T> of
(PTransform<PCollection<T>, ?> consumer) Returns a new Tee PTransform that will apply an auxilary transform to the input as well as pass it on.Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
-
Method Details
-
of
Returns a new Tee PTransform that will apply an auxilary transform to the input as well as pass it on.- Type Parameters:
T
- the type of the elements in the inputPCollection
.- Parameters:
consumer
- An additional PTransform that should process the input PCollection. Its output will be ignored.
-
of
Returns a new Tee PTransform that will apply an auxilary transform to the input as well as pass it on.- Type Parameters:
T
- the type of the elements in the inputPCollection
.- Parameters:
consumer
- An arbitraryConsumer
that will be wrapped in a PTransform and applied to the input. Its output will be ignored.
-
expand
Description copied from class:PTransform
Override this method to specify how thisPTransform
should be expanded on the givenInputT
.NOTE: This method should not be called directly. Instead apply the
PTransform
should be applied to theInputT
using theapply
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).
- Specified by:
expand
in classPTransform<PCollection<T>,
PCollection<T>>
-
getKindString
Description copied from class:PTransform
Returns the name to use by default for thisPTransform
(not including the names of any enclosingPTransform
s).By default, returns the base name of this
PTransform
's class.The caller is responsible for ensuring that names of applied
PTransform
s are unique, e.g., by adding a uniquifying suffix when needed.- Overrides:
getKindString
in classPTransform<PCollection<T>,
PCollection<T>>
-