public class FixedWindows extends PartitioningWindowingFn<java.lang.Object,IntervalWindow>
WindowingFn 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>by(FixedWindows.of(Duration.standardMinutes(10))));
WindowingFn.AssignContext, WindowingFn.MergeContext| Modifier and Type | Method and Description |
|---|---|
IntervalWindow |
assignWindow(Instant timestamp)
Returns the single window to which elements with this timestamp belong.
|
boolean |
isCompatible(WindowingFn<?,?> other)
Returns whether this performs the same merging as the given
WindowingFn. |
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 windowingFn. |
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.
|
assignWindowsmergeWindowspublic static FixedWindows of(Duration size)
public FixedWindows withOffset(Duration offset)
java.lang.IllegalArgumentException - if offset is not in [0, size)public IntervalWindow assignWindow(Instant timestamp)
PartitioningWindowingFnassignWindow in class PartitioningWindowingFn<java.lang.Object,IntervalWindow>public Coder<IntervalWindow> windowCoder()
WindowingFnCoder used for serializing the windows used
by this windowingFn.windowCoder in class WindowingFn<java.lang.Object,IntervalWindow>public boolean isCompatible(WindowingFn<?,?> other)
WindowingFnWindowingFn.isCompatible in class WindowingFn<java.lang.Object,IntervalWindow>