@Internal public class IdentityWindowFn<T> extends NonMergingWindowFn<T,BoundedWindow>
WindowFn
that leaves all associations between elements and windows unchanged.
This WindowFn
is applied when elements must be passed through a GroupByKey
,
but should maintain their existing Window
assignments. This will prevent merging if the
underlying WindowFn
would otherwise do so.
This WindowFn
is an internal implementation detail of sdk-provided utilities, and
should not be used by Pipeline
writers.
WindowFn.AssignContext, WindowFn.MergeContext
Constructor and Description |
---|
IdentityWindowFn(Coder<? extends BoundedWindow> coder) |
Modifier and Type | Method and Description |
---|---|
boolean |
assignsToOneWindow()
Returns true if this
WindowFn always assigns an element to exactly one window. |
java.util.Collection<BoundedWindow> |
assignWindows(WindowFn.AssignContext c)
Given a timestamp and element, returns the set of windows into which it should be placed.
|
WindowMappingFn<BoundedWindow> |
getDefaultWindowMappingFn()
Returns the default
WindowMappingFn to use to map main input windows to side input
windows. |
boolean |
isCompatible(WindowFn<?,?> other)
Returns whether this performs the same merging as the given
WindowFn . |
void |
verifyCompatibility(WindowFn<?,?> other)
Throw
IncompatibleWindowException if this WindowFn does not perform the same merging as
the given $WindowFn . |
Coder<BoundedWindow> |
windowCoder()
Returns the
Coder used for serializing the windows used by this windowFn. |
isNonMerging, mergeWindows
getWindowTypeDescriptor, populateDisplayData
public IdentityWindowFn(Coder<? extends BoundedWindow> coder)
public java.util.Collection<BoundedWindow> assignWindows(WindowFn.AssignContext c) throws java.lang.Exception
WindowFn
assignWindows
in class WindowFn<T,BoundedWindow>
java.lang.Exception
public boolean isCompatible(WindowFn<?,?> other)
WindowFn
WindowFn
.isCompatible
in class WindowFn<T,BoundedWindow>
public void verifyCompatibility(WindowFn<?,?> other) throws IncompatibleWindowException
WindowFn
IncompatibleWindowException
if this WindowFn does not perform the same merging as
the given $WindowFn
.verifyCompatibility
in class WindowFn<T,BoundedWindow>
IncompatibleWindowException
- if compared WindowFns are not compatible.public Coder<BoundedWindow> windowCoder()
WindowFn
Coder
used for serializing the windows used by this windowFn.windowCoder
in class WindowFn<T,BoundedWindow>
public WindowMappingFn<BoundedWindow> 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,BoundedWindow>
public 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,BoundedWindow>