Package org.apache.beam.sdk.util
Class IdentityWindowFn<T>
- java.lang.Object
-
- org.apache.beam.sdk.transforms.windowing.WindowFn<T,W>
-
- org.apache.beam.sdk.transforms.windowing.NonMergingWindowFn<T,BoundedWindow>
-
- org.apache.beam.sdk.util.IdentityWindowFn<T>
-
- All Implemented Interfaces:
java.io.Serializable
,HasDisplayData
@Internal public class IdentityWindowFn<T> extends NonMergingWindowFn<T,BoundedWindow>
AWindowFn
that leaves all associations between elements and windows unchanged.This
WindowFn
is applied when elements must be passed through aGroupByKey
, but should maintain their existingWindow
assignments. This will prevent merging if the underlyingWindowFn
would otherwise do so.This
WindowFn
is an internal implementation detail of sdk-provided utilities, and should not be used byPipeline
writers.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.beam.sdk.transforms.windowing.WindowFn
WindowFn.AssignContext, WindowFn.MergeContext
-
-
Constructor Summary
Constructors Constructor Description IdentityWindowFn(Coder<? extends BoundedWindow> coder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
assignsToOneWindow()
Returns true if thisWindowFn
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 defaultWindowMappingFn
to use to map main input windows to side input windows.boolean
isCompatible(WindowFn<?,?> other)
Returns whether this performs the same merging as the givenWindowFn
.void
verifyCompatibility(WindowFn<?,?> other)
ThrowIncompatibleWindowException
if this WindowFn does not perform the same merging as the given $WindowFn
.Coder<BoundedWindow>
windowCoder()
Returns theCoder
used for serializing the windows used by this windowFn.-
Methods inherited from class org.apache.beam.sdk.transforms.windowing.NonMergingWindowFn
isNonMerging, mergeWindows
-
Methods inherited from class org.apache.beam.sdk.transforms.windowing.WindowFn
getWindowTypeDescriptor, populateDisplayData
-
-
-
-
Constructor Detail
-
IdentityWindowFn
public IdentityWindowFn(Coder<? extends BoundedWindow> coder)
-
-
Method Detail
-
assignWindows
public java.util.Collection<BoundedWindow> assignWindows(WindowFn.AssignContext c) throws java.lang.Exception
Description copied from class:WindowFn
Given a timestamp and element, returns the set of windows into which it should be placed.- Specified by:
assignWindows
in classWindowFn<T,BoundedWindow>
- Throws:
java.lang.Exception
-
isCompatible
public boolean isCompatible(WindowFn<?,?> other)
Description copied from class:WindowFn
Returns whether this performs the same merging as the givenWindowFn
.- Specified by:
isCompatible
in classWindowFn<T,BoundedWindow>
-
verifyCompatibility
public void verifyCompatibility(WindowFn<?,?> other) throws IncompatibleWindowException
Description copied from class:WindowFn
ThrowIncompatibleWindowException
if this WindowFn does not perform the same merging as the given $WindowFn
.- Overrides:
verifyCompatibility
in classWindowFn<T,BoundedWindow>
- Throws:
IncompatibleWindowException
- if compared WindowFns are not compatible.
-
windowCoder
public Coder<BoundedWindow> windowCoder()
Description copied from class:WindowFn
Returns theCoder
used for serializing the windows used by this windowFn.- Specified by:
windowCoder
in classWindowFn<T,BoundedWindow>
-
getDefaultWindowMappingFn
public WindowMappingFn<BoundedWindow> getDefaultWindowMappingFn()
Description copied from class:WindowFn
Returns the defaultWindowMappingFn
to use to map main input windows to side input windows. This should accept arbitrary main input windows, and produce aBoundedWindow
that can be produced by thisWindowFn
.- Specified by:
getDefaultWindowMappingFn
in classWindowFn<T,BoundedWindow>
-
assignsToOneWindow
public boolean assignsToOneWindow()
Description copied from class:WindowFn
Returns true if thisWindowFn
always assigns an element to exactly one window.If this varies per-element, or cannot be determined, conservatively return false.
By default, returns false.
- Overrides:
assignsToOneWindow
in classWindowFn<T,BoundedWindow>
-
-