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 |
assignsToOneWindow()
Returns true if this
WindowFn always assigns an element to exactly one window. |
abstract W |
assignWindow(Instant timestamp)
Returns the single window to which elements with this timestamp belong.
|
java.util.Collection<W> |
assignWindows(WindowFn.AssignContext c)
Given a timestamp and element, returns the set of windows into which it should be placed.
|
WindowMappingFn<W> |
getDefaultWindowMappingFn()
Returns the default
WindowMappingFn to use to map main input windows to side input
windows. |
Instant |
getOutputTime(Instant inputTimestamp,
W window)
Returns the output timestamp to use for data depending on the given
inputTimestamp in
the specified window . |
isNonMerging, mergeWindows
getWindowTypeDescriptor, isCompatible, populateDisplayData, verifyCompatibility, windowCoder
public abstract W assignWindow(Instant timestamp)
public final java.util.Collection<W> assignWindows(WindowFn.AssignContext c)
WindowFn
assignWindows
in class WindowFn<T,W extends BoundedWindow>
public WindowMappingFn<W> getDefaultWindowMappingFn()
WindowFn
WindowMappingFn
to use to map main input windows to side input
windows. This should accept arbitrary main input windows, and produce a BoundedWindow
that can be produced by this WindowFn
.getDefaultWindowMappingFn
in class WindowFn<T,W extends BoundedWindow>
public Instant getOutputTime(Instant inputTimestamp, W window)
WindowFn
inputTimestamp
in
the specified window
.
The result of this method must be between inputTimestamp
and window.maxTimestamp()
(inclusive on both sides).
This function must be monotonic across input timestamps. Specifically, if A < B
,
then getOutputTime(A, window) <= getOutputTime(B, window)
.
For a WindowFn
that doesn't produce overlapping windows, this can (and typically
should) just return inputTimestamp
. In the presence of 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.
getOutputTime
in class WindowFn<T,W extends BoundedWindow>
public final boolean assignsToOneWindow()
WindowFn
WindowFn
always assigns an element to exactly one window.
If this varies per-element, or cannot be determined, conservatively return false.
By default, returns false.
assignsToOneWindow
in class WindowFn<T,W extends BoundedWindow>