public class SlidingWindows extends NonMergingWindowingFn<java.lang.Object,IntervalWindow>
For example, in order to window data into 10 minute windows that update every minute:
PCollection<Integer> items = ...;
PCollection<Integer> windowedItems = items.apply(
Window.<Integer>by(SlidingWindows.of(Duration.standardMinutes(10))));
WindowingFn.AssignContext, WindowingFn.MergeContext| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<IntervalWindow> |
assignWindows(WindowingFn.AssignContext c)
Given a timestamp and element, returns the set of windows into which it
should be placed.
|
SlidingWindows |
every(Duration period)
Returns a new
SlidingWindows with the original size, that assigns
timestamps into half-open intervals of the form
[N * period, N * period + size), where 0 is the epoch. |
boolean |
isCompatible(WindowingFn<?,?> other)
Returns whether this performs the same merging as the given
WindowingFn. |
static SlidingWindows |
of(Duration size)
Assigns timestamps into half-open intervals of the form
[N * period, N * period + size), where 0 is the epoch.
|
Coder<IntervalWindow> |
windowCoder()
Returns the
Coder used for serializing the windows used
by this windowingFn. |
SlidingWindows |
withOffset(Duration offset)
Assigns timestamps into half-open intervals of the form
[N * period + offset, N * period + offset + size).
|
mergeWindowspublic static SlidingWindows of(Duration size)
If every(org.joda.time.Duration) is not called, the period defaults
to one millisecond.
public SlidingWindows every(Duration period)
SlidingWindows with the original size, that assigns
timestamps into half-open intervals of the form
[N * period, N * period + size), where 0 is the epoch.public SlidingWindows withOffset(Duration offset)
java.lang.IllegalArgumentException - if offset is not in [0, period)public Coder<IntervalWindow> windowCoder()
WindowingFnCoder used for serializing the windows used
by this windowingFn.windowCoder in class WindowingFn<java.lang.Object,IntervalWindow>public java.util.Collection<IntervalWindow> assignWindows(WindowingFn.AssignContext c)
WindowingFnassignWindows in class WindowingFn<java.lang.Object,IntervalWindow>public boolean isCompatible(WindowingFn<?,?> other)
WindowingFnWindowingFn.isCompatible in class WindowingFn<java.lang.Object,IntervalWindow>