Class FixedWindows
java.lang.Object
org.apache.beam.sdk.transforms.windowing.WindowFn<Object,IntervalWindow>
org.apache.beam.sdk.transforms.windowing.NonMergingWindowFn<Object,IntervalWindow>
org.apache.beam.sdk.transforms.windowing.PartitioningWindowFn<Object,IntervalWindow>
org.apache.beam.sdk.transforms.windowing.FixedWindows
- All Implemented Interfaces:
Serializable,HasDisplayData
A
WindowFn that windows values into fixed-size timestamp-based windows.
For example, in order to partition the data into 10 minute windows:
PCollection<Integer> items = ...;
PCollection<Integer> windowedItems = items.apply(
Window.<Integer>into(FixedWindows.of(Duration.standardMinutes(10))));
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.transforms.windowing.WindowFn
WindowFn.AssignContext, WindowFn.MergeContext -
Method Summary
Modifier and TypeMethodDescriptionassignWindow(Instant timestamp) Returns the single window to which elements with this timestamp belong.booleangetSize()inthashCode()booleanisCompatible(WindowFn<?, ?> other) Returns whether this performs the same merging as the givenWindowFn.static FixedWindowsPartitions the timestamp space into half-open intervals of the form [N * size, (N + 1) * size), where 0 is the epoch.voidpopulateDisplayData(DisplayData.Builder builder) Register display data for the given transform or component.voidverifyCompatibility(WindowFn<?, ?> other) ThrowIncompatibleWindowExceptionif this WindowFn does not perform the same merging as the given $WindowFn.Returns theCoderused for serializing the windows used by this windowFn.withOffset(Duration offset) Partitions the timestamp space into half-open intervals of the form [N * size + offset, (N + 1) * size + offset), where 0 is the epoch.Methods inherited from class org.apache.beam.sdk.transforms.windowing.PartitioningWindowFn
assignsToOneWindow, assignWindows, getDefaultWindowMappingFnMethods inherited from class org.apache.beam.sdk.transforms.windowing.NonMergingWindowFn
isNonMerging, mergeWindowsMethods inherited from class org.apache.beam.sdk.transforms.windowing.WindowFn
getWindowTypeDescriptor
-
Method Details
-
of
Partitions the timestamp space into half-open intervals of the form [N * size, (N + 1) * size), where 0 is the epoch. -
withOffset
Partitions the timestamp space into half-open intervals of the form [N * size + offset, (N + 1) * size + offset), where 0 is the epoch.- Throws:
IllegalArgumentException- if offset is not in [0, size)
-
assignWindow
Description copied from class:PartitioningWindowFnReturns the single window to which elements with this timestamp belong.- Specified by:
assignWindowin classPartitioningWindowFn<Object,IntervalWindow>
-
populateDisplayData
Description copied from class:WindowFnRegister display data for the given transform or component.populateDisplayData(DisplayData.Builder)is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData). Implementations may callsuper.populateDisplayData(builder)in order to register display data in the current namespace, but should otherwise usesubcomponent.populateDisplayData(builder)to use the namespace of the subcomponent.By default, does not register any display data. Implementors may override this method to provide their own display data.
- Specified by:
populateDisplayDatain interfaceHasDisplayData- Overrides:
populateDisplayDatain classWindowFn<Object,IntervalWindow> - Parameters:
builder- The builder to populate with display data.- See Also:
-
windowCoder
Description copied from class:WindowFnReturns theCoderused for serializing the windows used by this windowFn.- Specified by:
windowCoderin classWindowFn<Object,IntervalWindow>
-
isCompatible
Description copied from class:WindowFnReturns whether this performs the same merging as the givenWindowFn.- Specified by:
isCompatiblein classWindowFn<Object,IntervalWindow>
-
verifyCompatibility
Description copied from class:WindowFnThrowIncompatibleWindowExceptionif this WindowFn does not perform the same merging as the given $WindowFn.- Overrides:
verifyCompatibilityin classWindowFn<Object,IntervalWindow> - Throws:
IncompatibleWindowException- if compared WindowFns are not compatible.
-
getSize
-
getOffset
-
equals
-
hashCode
public int hashCode()
-