Package org.apache.beam.sdk.transforms.windowing
Window transform for dividing the
elements in a PCollection into windows, and the Trigger for controlling when those elements are output.
Window logically divides up or groups the elements of a PCollection into finite windows according to a WindowFn. The output of Window contains the
same elements as input, but they have been logically assigned to windows. The next GroupByKeys, including one within composite transforms, will
group by the combination of keys and windows.
Windowing a PCollection allows chunks of it to be processed individually, before the
entire PCollection is available. This is especially important for PCollections
with unbounded size, since the full PCollection is never available at once.
For PCollections with a bounded size, by default, all data is implicitly in a single
window, and this replicates conventional batch mode. However, windowing can still be a convenient
way to express time-sliced algorithms over bounded PCollections.
As elements are assigned to a window, they are placed into a pane. When the trigger fires all of the elements in the current pane are output.
The DefaultTrigger will output a window when
the system watermark passes the end of the window. See AfterWatermark for details on the watermark.
-
ClassDescriptionA composite
Triggerthat fires when all of its sub-triggers are ready.A compositeTriggerthat executes its sub-triggers in order.A compositeTriggerthat fires once after at least one of its sub-triggers have fired.ATriggerthat fires at some point after a specified number of input elements have arrived.ATriggertrigger that fires at a specified point in processing time, relative to when input first arrives.FOR INTERNAL USE ONLY.AfterWatermarktriggers fire based on progress of the system watermark.A watermark trigger targeted relative to the end of the window.ABoundedWindowrepresents window information assigned to data elements.A collection ofWindowFns that windows values into calendar-based windows such as spans of days, months, or years.AWindowFnthat windows elements into periods measured by days.AWindowFnthat windows elements into periods measured by months.AWindowFnthat windows elements into periods measured by years.A trigger that is equivalent toRepeatedly.forever(AfterWatermark.pastEndOfWindow()).AWindowFnthat windows values into fixed-size timestamp-based windows.The default window into which all data is placed (viaGlobalWindows).GlobalWindow.Coderfor encoding and decodingGlobalWindows.AWindowFnthat assigns all data to the same window.Exception thrown byWindowFn.verifyCompatibility(WindowFn)if two compared WindowFns are not compatible, including the explanation of incompatibility.An implementation ofBoundedWindowthat represents an interval fromIntervalWindow.start(inclusive) toIntervalWindow.end(exclusive).Encodes anIntervalWindowas a pair of its upper bound and duration.For internal use only; no backwards compatibility guarantees.ATriggerwhich never fires.The actual trigger class forNevertriggers.NonMergingWindowFn<T,W extends BoundedWindow> Abstract base class forWindowFnsthat do not merge windows.ATriggerthat executes according to its main trigger until its "finally" trigger fires.Provides information about the pane an element belongs to.A Coder for encoding PaneInfo instances.Enumerates the possibilities for the timing of this pane firing related to the input and output watermarks for its computation.PartitioningWindowFn<T,W extends BoundedWindow> AWindowFnthat places each value into exactly one window based on its timestamp and never merges windows.ATriggerthat fires according to its subtrigger forever.ReshuffleTrigger<W extends BoundedWindow>For internal use only; no backwards compatibility guarantees.AWindowFnthat windows values into sessions separated by periods with no input for at least the duration specified bySessions.getGapDuration().AWindowFnthat windows values into possibly overlapping fixed-size timestamp-based windows.Policies for combining timestamps that occur within a window.For internal use only; no backwards-compatibility guarantees.For internal use only; no backwards-compatibility guarantees.For internal use only; no backwards-compatibility guarantees.Triggers control when the elements for a specific key and window are output.For internal use only; no backwards-compatibility guarantees.Window<T>Windowlogically divides up or groups the elements of aPCollectioninto finite windows according to aWindowFn.A PrimitivePTransformthat assigns windows to elements based on aWindowFn.Specifies the conditions under which a final pane will be created when a window is permanently closed.Specifies the conditions under which an on-time pane will be created when a window is closed.WindowFn<T,W extends BoundedWindow> The argument to theWindowtransform used to assign elements into windows and to determine how windows are merged.WindowMappingFn<TargetWindowT extends BoundedWindow>A function that takes the windows of elements in a main input and maps them to the appropriate window in aPCollectionViewconsumed as aside input.