T
- the element type of the input PCollectionpublic class Tee<T> extends PTransform<PCollection<T>,PCollection<T>>
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(...);
annotations, displayData, name, resourceHints
Modifier and Type | Method and Description |
---|---|
PCollection<T> |
expand(PCollection<T> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
protected java.lang.String |
getKindString()
Returns the name to use by default for this
PTransform (not including the names of any
enclosing PTransform s). |
static <T> Tee<T> |
of(java.util.function.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.
|
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
public static <T> Tee<T> of(PTransform<PCollection<T>,?> consumer)
T
- the type of the elements in the input PCollection
.consumer
- An additional PTransform that should process the input PCollection. Its output
will be ignored.public static <T> Tee<T> of(java.util.function.Consumer<PCollection<T>> consumer)
T
- the type of the elements in the input PCollection
.consumer
- An arbitrary Consumer
that will be wrapped in a PTransform and applied
to the input. Its output will be ignored.public PCollection<T> expand(PCollection<T> 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<PCollection<T>,PCollection<T>>
protected java.lang.String getKindString()
PTransform
PTransform
(not including the names of any
enclosing PTransform
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.
getKindString
in class PTransform<PCollection<T>,PCollection<T>>