public class FixedWindows extends PartitioningWindowFn<Object,IntervalWindow>
WindowFn that windows values into fixed-size timestamp-based windows.
For example, in order to partition the data into 10 minute windows:
PCollection<Integer> items = ...;
PCollection<Integer> windowedItems = items.apply(
Window.<Integer>into(FixedWindows.of(Duration.standardMinutes(10))));
WindowFn.AssignContext, WindowFn.MergeContext| Modifier and Type | Method and Description |
|---|---|
IntervalWindow |
assignWindow(Instant timestamp)
Returns the single window to which elements with this timestamp belong.
|
boolean |
equals(Object object) |
Duration |
getOffset() |
Duration |
getSize() |
int |
hashCode() |
boolean |
isCompatible(WindowFn<?,?> other)
Returns whether this performs the same merging as the given
WindowFn. |
static FixedWindows |
of(Duration size)
Partitions the timestamp space into half-open intervals of the form
[N * size, (N + 1) * size), where 0 is the epoch.
|
Coder<IntervalWindow> |
windowCoder()
Returns the
Coder used for serializing the windows used
by this windowFn. |
FixedWindows |
withOffset(Duration offset)
Partitions the timestamp space into half-open intervals of the form
[N * size + offset, (N + 1) * size + offset),
where 0 is the epoch.
|
assignsToSingleWindow, assignWindows, getOutputTime, getSideInputWindowisNonMerging, mergeWindowsgetOutputTimeFnpublic static FixedWindows of(Duration size)
public FixedWindows withOffset(Duration offset)
IllegalArgumentException - if offset is not in [0, size)public IntervalWindow assignWindow(Instant timestamp)
PartitioningWindowFnassignWindow in class PartitioningWindowFn<Object,IntervalWindow>public Coder<IntervalWindow> windowCoder()
WindowFnCoder used for serializing the windows used
by this windowFn.windowCoder in class WindowFn<Object,IntervalWindow>public boolean isCompatible(WindowFn<?,?> other)
WindowFnWindowFn.isCompatible in class WindowFn<Object,IntervalWindow>public Duration getSize()
public Duration getOffset()