T - type of elements being windowedW - window typepublic abstract class PartitioningWindowFn<T,W extends BoundedWindow> extends NonMergingWindowFn<T,W>
WindowFn that places each value into exactly one window
based on its timestamp and never merges windows.WindowFn.AssignContext, WindowFn.MergeContext| Constructor and Description |
|---|
PartitioningWindowFn() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
assignsToSingleWindow()
Returns true if this
WindowFn assigns each element to a single window. |
abstract W |
assignWindow(org.joda.time.Instant timestamp)
Returns the single window to which elements with this timestamp belong.
|
Collection<W> |
assignWindows(WindowFn.AssignContext c)
Given a timestamp and element, returns the set of windows into which it
should be placed.
|
org.joda.time.Instant |
getOutputTime(org.joda.time.Instant inputTimestamp,
W window)
Returns the output timestamp to use for data depending on the given
inputTimestamp
in the specified window. |
W |
getSideInputWindow(BoundedWindow window)
Returns the window of the side input corresponding to the given window of
the main input.
|
isNonMerging, mergeWindowsisCompatible, windowCoderpublic abstract W assignWindow(org.joda.time.Instant timestamp)
public final Collection<W> assignWindows(WindowFn.AssignContext c)
WindowFnassignWindows in class WindowFn<T,W extends BoundedWindow>public W getSideInputWindow(BoundedWindow window)
WindowFnAuthors of custom WindowFns should override this.
getSideInputWindow in class WindowFn<T,W extends BoundedWindow>public boolean assignsToSingleWindow()
WindowFnWindowFn assigns each element to a single window.assignsToSingleWindow in class WindowFn<T,W extends BoundedWindow>public org.joda.time.Instant getOutputTime(org.joda.time.Instant inputTimestamp,
W window)
WindowFninputTimestamp
in the specified window.
The result must be between inputTimestamp and window.maxTimestamp()
(inclusive on both sides). If this WindowFn doesn't produce overlapping windows,
this can (and typically should) just return inputTimestamp. If this does produce
overlapping windows, it is suggested that the result in later overlapping windows is
past the end of earlier windows so that the later windows don't prevent the watermark from
progressing past the end of the earlier window.
Each KV<K, Iterable<V>> produced from a GroupByKey will be output at a
timestamp that is the minimum of getOutputTime applied to the timestamp of all of
the non-late KV<K, V> that were used as input to the GroupByKey. The watermark
is also prevented from advancing past this minimum timestamp until after the
KV<K, Iterable<V>> has been output.
This function should be monotonic across input timestamps. Specifically, if A < B,
then getOutputTime(A, window) <= getOutputTime(B, window).
getOutputTime in class WindowFn<T,W extends BoundedWindow>