T
- The type of elements this Window
is applied topublic static class Window.Bound<T> extends PTransform<PCollection<T>,PCollection<T>>
PTransform
that windows the elements of a PCollection<T>
,
into finite windows according to a user-specified WindowFn
.name
Modifier and Type | Method and Description |
---|---|
Window.Bound<T> |
accumulatingFiredPanes()
Returns a new
Window PTransform that uses the registered WindowFn and
Triggering behavior, and that accumulates elements in a pane after they are triggered. |
PCollection<T> |
apply(PCollection<T> input)
Applies this
PTransform on the given InputT , and returns its
Output . |
Window.Bound<T> |
discardingFiredPanes()
Returns a new
Window PTransform that uses the registered WindowFn and
Triggering behavior, and that discards elements in a pane after they are triggered. |
protected Coder<?> |
getDefaultOutputCoder(PCollection<T> input)
Returns the default
Coder to use for the output of this
single-output PTransform when applied to the given input. |
protected String |
getKindString()
Returns the name to use by default for this
PTransform
(not including the names of any enclosing PTransform s). |
com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> |
getOutputStrategyInternal(com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> inputStrategy)
Get the output strategy of this
Window PTransform . |
WindowFn<? super T,?> |
getWindowFn()
Get the
WindowFn of this Window PTransform . |
Window.Bound<T> |
named(String name)
Returns a new
Window PTransform that's like this
PTransform but with the specified name. |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
Window.Bound<T> |
triggering(TriggerBuilder<?> trigger)
Sets a non-default trigger for this
Window PTransform . |
void |
validate(PCollection<T> input)
Called before invoking apply (which may be intercepted by the runner) to
verify this transform is fully specified and applicable to the specified
input.
|
Window.Bound<T> |
withAllowedLateness(Duration allowedLateness)
Override the amount of lateness allowed for data elements in the pipeline.
|
Window.Bound<T> |
withAllowedLateness(Duration allowedLateness,
Window.ClosingBehavior behavior)
Override the amount of lateness allowed for data elements in the pipeline.
|
Window.Bound<T> |
withOutputTimeFn(OutputTimeFn<?> outputTimeFn)
(Experimental) Override the default
OutputTimeFn , to control
the output timestamp of values output from a GroupByKey operation. |
getDefaultOutputCoder, getDefaultOutputCoder, getName, toString
public Window.Bound<T> named(String name)
Window
PTransform
that's like this
PTransform
but with the specified name. Does not
modify this PTransform
.
See the discussion of Naming in
ParDo
for more
explanation.
@Experimental(value=TRIGGER) public Window.Bound<T> triggering(TriggerBuilder<?> trigger)
Window
PTransform
.
Elements that are assigned to a specific window will be output when
the trigger fires.
Trigger
has more details on the available triggers.
Must also specify allowed lateness using withAllowedLateness(org.joda.time.Duration)
and accumulation
mode using either discardingFiredPanes()
or accumulatingFiredPanes()
.
@Experimental(value=TRIGGER) public Window.Bound<T> discardingFiredPanes()
Window
PTransform
that uses the registered WindowFn and
Triggering behavior, and that discards elements in a pane after they are triggered.
Does not modify this transform. The resulting PTransform
is sufficiently
specified to be applied, but more properties can still be specified.
@Experimental(value=TRIGGER) public Window.Bound<T> accumulatingFiredPanes()
Window
PTransform
that uses the registered WindowFn and
Triggering behavior, and that accumulates elements in a pane after they are triggered.
Does not modify this transform. The resulting PTransform
is sufficiently
specified to be applied, but more properties can still be specified.
@Experimental(value=TRIGGER) public Window.Bound<T> withAllowedLateness(Duration allowedLateness)
Window
operation, this will be applied at
the next GroupByKey
. Any elements that are later than this as decided by
the system-maintained watermark will be dropped.
This value also determines how long state will be kept around for old windows. Once no elements will be added to a window (because this duration has passed) any state associated with the window will be cleaned up.
Depending on the trigger this may not produce a pane with PaneInfo.isLast
. See
Window.ClosingBehavior.FIRE_IF_NON_EMPTY
for more details.
@Experimental(value=OUTPUT_TIME) public Window.Bound<T> withOutputTimeFn(OutputTimeFn<?> outputTimeFn)
OutputTimeFn
, to control
the output timestamp of values output from a GroupByKey
operation.@Experimental(value=TRIGGER) public Window.Bound<T> withAllowedLateness(Duration allowedLateness, Window.ClosingBehavior behavior)
Window
operation, this will be applied at
the next GroupByKey
. Any elements that are later than this as decided by
the system-maintained watermark will be dropped.
This value also determines how long state will be kept around for old windows. Once no elements will be added to a window (because this duration has passed) any state associated with the window will be cleaned up.
public com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> getOutputStrategyInternal(com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> inputStrategy)
Window PTransform
. For internal use
only.public WindowFn<? super T,?> getWindowFn()
WindowFn
of this Window PTransform
.public void validate(PCollection<T> input)
PTransform
By default, does nothing.
validate
in class PTransform<PCollection<T>,PCollection<T>>
public PCollection<T> apply(PCollection<T> input)
PTransform
PTransform
on the given InputT
, and returns its
Output
.
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).
The default implementation throws an exception. A derived class must
either implement apply, or else each runner must supply a custom
implementation via
PipelineRunner.apply(com.google.cloud.dataflow.sdk.transforms.PTransform<InputT, OutputT>, InputT)
.
apply
in class PTransform<PCollection<T>,PCollection<T>>
public void populateDisplayData(DisplayData.Builder builder)
PTransform
populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect
display data via DisplayData.from(HasDisplayData)
. Implementations may call
super.populateDisplayData(builder)
in order to register display data in the current
namespace, but should otherwise use subcomponent.populateDisplayData(builder)
to use
the namespace of the subcomponent.
By default, does not register any display data. Implementors may override this method to provide their own display data.
populateDisplayData
in interface HasDisplayData
populateDisplayData
in class PTransform<PCollection<T>,PCollection<T>>
builder
- The builder to populate with display data.HasDisplayData
protected Coder<?> getDefaultOutputCoder(PCollection<T> input)
PTransform
Coder
to use for the output of this
single-output PTransform
when applied to the given input.getDefaultOutputCoder
in class PTransform<PCollection<T>,PCollection<T>>
protected 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>>