Google Cloud Dataflow SDK for Java, version 1.9.1
Class Window.Bound<T>
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.transforms.PTransform<PCollection<T>,PCollection<T>>
-
- com.google.cloud.dataflow.sdk.transforms.windowing.Window.Bound<T>
-
- Type Parameters:
T
- The type of elements thisWindow
is applied to
- All Implemented Interfaces:
- HasDisplayData, Serializable
- Enclosing class:
- Window
public static class Window.Bound<T> extends PTransform<PCollection<T>,PCollection<T>>
APTransform
that windows the elements of aPCollection<T>
, into finite windows according to a user-specifiedWindowFn
.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
name
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Window.Bound<T>
accumulatingFiredPanes()
Returns a newWindow
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 thisPTransform
on the givenInputT
, and returns itsOutput
.Window.Bound<T>
discardingFiredPanes()
Returns a newWindow
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 defaultCoder
to use for the output of this single-outputPTransform
when applied to the given input.protected String
getKindString()
Returns the name to use by default for thisPTransform
(not including the names of any enclosingPTransform
s).com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?>
getOutputStrategyInternal(com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> inputStrategy)
Get the output strategy of thisWindow PTransform
.WindowFn<? super T,?>
getWindowFn()
Get theWindowFn
of thisWindow PTransform
.Window.Bound<T>
named(String name)
Returns a newWindow
PTransform
that's like thisPTransform
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 thisWindow
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 defaultOutputTimeFn
, to control the output timestamp of values output from aGroupByKey
operation.-
Methods inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
getDefaultOutputCoder, getDefaultOutputCoder, getName, toString
-
-
-
-
Method Detail
-
named
public Window.Bound<T> named(String name)
Returns a newWindow
PTransform
that's like thisPTransform
but with the specified name. Does not modify thisPTransform
.See the discussion of Naming in
ParDo
for more explanation.
-
triggering
@Experimental(value=TRIGGER) public Window.Bound<T> triggering(TriggerBuilder<?> trigger)
Sets a non-default trigger for thisWindow
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 eitherdiscardingFiredPanes()
oraccumulatingFiredPanes()
.
-
discardingFiredPanes
@Experimental(value=TRIGGER) public Window.Bound<T> discardingFiredPanes()
Returns a newWindow
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.
-
accumulatingFiredPanes
@Experimental(value=TRIGGER) public Window.Bound<T> accumulatingFiredPanes()
Returns a newWindow
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.
-
withAllowedLateness
@Experimental(value=TRIGGER) public Window.Bound<T> withAllowedLateness(Duration allowedLateness)
Override the amount of lateness allowed for data elements in the pipeline. Like the other properties on thisWindow
operation, this will be applied at the nextGroupByKey
. 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
. SeeWindow.ClosingBehavior.FIRE_IF_NON_EMPTY
for more details.
-
withOutputTimeFn
@Experimental(value=OUTPUT_TIME) public Window.Bound<T> withOutputTimeFn(OutputTimeFn<?> outputTimeFn)
(Experimental) Override the defaultOutputTimeFn
, to control the output timestamp of values output from aGroupByKey
operation.
-
withAllowedLateness
@Experimental(value=TRIGGER) public Window.Bound<T> withAllowedLateness(Duration allowedLateness, Window.ClosingBehavior behavior)
Override the amount of lateness allowed for data elements in the pipeline. Like the other properties on thisWindow
operation, this will be applied at the nextGroupByKey
. 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.
-
getOutputStrategyInternal
public com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> getOutputStrategyInternal(com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> inputStrategy)
Get the output strategy of thisWindow PTransform
. For internal use only.
-
getWindowFn
public WindowFn<? super T,?> getWindowFn()
Get theWindowFn
of thisWindow PTransform
.
-
validate
public void validate(PCollection<T> input)
Description copied from class:PTransform
Called before invoking apply (which may be intercepted by the runner) to verify this transform is fully specified and applicable to the specified input.By default, does nothing.
- Overrides:
validate
in classPTransform<PCollection<T>,PCollection<T>>
-
apply
public PCollection<T> apply(PCollection<T> input)
Description copied from class:PTransform
Applies thisPTransform
on the givenInputT
, and returns itsOutput
.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)
.- Overrides:
apply
in classPTransform<PCollection<T>,PCollection<T>>
-
populateDisplayData
public void populateDisplayData(DisplayData.Builder builder)
Description copied from class:PTransform
Register display data for the given transform or component.populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData)
. Implementations may callsuper.populateDisplayData(builder)
in order to register display data in the current namespace, but should otherwise usesubcomponent.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.
- Specified by:
populateDisplayData
in interfaceHasDisplayData
- Overrides:
populateDisplayData
in classPTransform<PCollection<T>,PCollection<T>>
- Parameters:
builder
- The builder to populate with display data.- See Also:
HasDisplayData
-
getDefaultOutputCoder
protected Coder<?> getDefaultOutputCoder(PCollection<T> input)
Description copied from class:PTransform
Returns the defaultCoder
to use for the output of this single-outputPTransform
when applied to the given input.By default, always throws.
- Overrides:
getDefaultOutputCoder
in classPTransform<PCollection<T>,PCollection<T>>
-
getKindString
protected String 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>>
-
-