public class Sessions extends WindowFn<java.lang.Object,IntervalWindow>
gapDuration-long
periods with no elements.
For example, in order to window data into session with at least 10 minute gaps in between them:
PCollection<Integer> pc = ...;
PCollection<Integer> windowed_pc = pc.apply(
Window.<Integer>by(Sessions.withGapDuration(Duration.standardMinutes(10))));
WindowFn.AssignContext, WindowFn.MergeContext| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<IntervalWindow> |
assignWindows(WindowFn.AssignContext c)
Given a timestamp and element, returns the set of windows into which it
should be placed.
|
boolean |
isCompatible(WindowFn<?,?> other)
Returns whether this performs the same merging as the given
WindowFn. |
void |
mergeWindows(WindowFn.MergeContext c)
Does whatever merging of windows is necessary.
|
Coder<IntervalWindow> |
windowCoder()
Returns the
Coder used for serializing the windows used
by this windowFn. |
static Sessions |
withGapDuration(Duration gapDuration)
Creates a
Sessions WindowFn with the specified gap duration. |
getSideInputWindowpublic static Sessions withGapDuration(Duration gapDuration)
Sessions WindowFn with the specified gap duration.public java.util.Collection<IntervalWindow> assignWindows(WindowFn.AssignContext c)
WindowFnassignWindows in class WindowFn<java.lang.Object,IntervalWindow>public void mergeWindows(WindowFn.MergeContext c) throws java.lang.Exception
WindowFn See MergeOverlappingIntervalWindows.mergeWindows(com.google.cloud.dataflow.sdk.transforms.windowing.WindowFn<?, com.google.cloud.dataflow.sdk.transforms.windowing.IntervalWindow>.MergeContext) for an
example of how to override this method.
mergeWindows in class WindowFn<java.lang.Object,IntervalWindow>java.lang.Exceptionpublic Coder<IntervalWindow> windowCoder()
WindowFnCoder used for serializing the windows used
by this windowFn.windowCoder in class WindowFn<java.lang.Object,IntervalWindow>public boolean isCompatible(WindowFn<?,?> other)
WindowFnWindowFn.isCompatible in class WindowFn<java.lang.Object,IntervalWindow>