public static class UnsliceAssigners.WindowedUnsliceAssigner extends MergingWindowAssigner<TimeWindow> implements UnsliceAssigner<TimeWindow>, InternalTimeWindowAssigner
UnsliceAssigner
for elements have been merged into unslicing windows and attached
window start and end timestamps.Constructor and Description |
---|
WindowedUnsliceAssigner(int windowStartIndex,
int windowEndIndex,
UnsliceAssigner<TimeWindow> innerAssigner) |
Modifier and Type | Method and Description |
---|---|
Optional<TimeWindow> |
assignActualWindow(RowData element,
ClockService clock,
MergingWindowProcessFunction<?,TimeWindow> windowFunction)
Returns the
Window that the given element should belong to be used to trigger on. |
Optional<TimeWindow> |
assignStateNamespace(RowData element,
ClockService clock,
MergingWindowProcessFunction<?,TimeWindow> windowFunction)
Returns the
Window that the given element should belong to be used as a namespace to
restore the state. |
Collection<TimeWindow> |
assignWindows(RowData element,
long timestamp)
Given the timestamp and element, returns the set of windows into which it should be placed.
|
String |
getDescription()
Returns a description of this window assigner.
|
MergingWindowAssigner<TimeWindow> |
getMergingWindowAssigner()
Currently, unslice assigner has an inner
MergingWindowAssigner to reuse the logic in
GroupWindowAssigner to
merge windows. |
TypeSerializer<TimeWindow> |
getWindowSerializer(ExecutionConfig executionConfig)
Returns a
TypeSerializer for serializing windows that are assigned by this WindowAssigner . |
boolean |
isEventTime()
Returns
true if elements are assigned to windows based on event time, false
otherwise. |
void |
mergeWindows(TimeWindow newWindow,
NavigableSet<TimeWindow> sortedWindows,
MergeCallback<TimeWindow,Collection<TimeWindow>> callback)
Determines which windows (if any) should be merged.
|
String |
toString() |
InternalTimeWindowAssigner |
withEventTime() |
InternalTimeWindowAssigner |
withProcessingTime() |
open
public WindowedUnsliceAssigner(int windowStartIndex, int windowEndIndex, UnsliceAssigner<TimeWindow> innerAssigner)
public Optional<TimeWindow> assignActualWindow(RowData element, ClockService clock, MergingWindowProcessFunction<?,TimeWindow> windowFunction) throws Exception
UnsliceAssigner
Window
that the given element should belong to be used to trigger on.
See more details in MergingWindowProcessFunction.assignActualWindows(org.apache.flink.table.data.RowData, long)
.
assignActualWindow
in interface UnsliceAssigner<TimeWindow>
element
- the element to which slice should belong to.clock
- the service to get current processing time.Exception
public Optional<TimeWindow> assignStateNamespace(RowData element, ClockService clock, MergingWindowProcessFunction<?,TimeWindow> windowFunction) throws Exception
UnsliceAssigner
Window
that the given element should belong to be used as a namespace to
restore the state.
See more details in MergingWindowProcessFunction.assignStateNamespace(org.apache.flink.table.data.RowData, long)
.
assignStateNamespace
in interface UnsliceAssigner<TimeWindow>
element
- the element to which slice should belong to.clock
- the service to get current processing time.Exception
public MergingWindowAssigner<TimeWindow> getMergingWindowAssigner()
UnsliceAssigner
MergingWindowAssigner
to reuse the logic in
GroupWindowAssigner
to
merge windows.getMergingWindowAssigner
in interface UnsliceAssigner<TimeWindow>
public boolean isEventTime()
GroupWindowAssigner
true
if elements are assigned to windows based on event time, false
otherwise.isEventTime
in interface WindowAssigner
isEventTime
in class GroupWindowAssigner<TimeWindow>
public Collection<TimeWindow> assignWindows(RowData element, long timestamp) throws IOException
GroupWindowAssigner
assignWindows
in class GroupWindowAssigner<TimeWindow>
element
- The element to which windows should be assigned.timestamp
- The timestamp of the element when GroupWindowAssigner.isEventTime()
returns true, or
the current system time when GroupWindowAssigner.isEventTime()
returns false. The timestamp value is
mapping to UTC milliseconds for splitting windows simply.IOException
public TypeSerializer<TimeWindow> getWindowSerializer(ExecutionConfig executionConfig)
GroupWindowAssigner
TypeSerializer
for serializing windows that are assigned by this WindowAssigner
.getWindowSerializer
in class GroupWindowAssigner<TimeWindow>
public String toString()
toString
in class GroupWindowAssigner<TimeWindow>
public String getDescription()
WindowAssigner
getDescription
in interface WindowAssigner
public InternalTimeWindowAssigner withEventTime()
withEventTime
in interface InternalTimeWindowAssigner
public InternalTimeWindowAssigner withProcessingTime()
withProcessingTime
in interface InternalTimeWindowAssigner
public void mergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergeCallback<TimeWindow,Collection<TimeWindow>> callback)
MergingWindowAssigner
mergeWindows
in class MergingWindowAssigner<TimeWindow>
newWindow
- The new windowsortedWindows
- The sorted window candidates.callback
- A callback that can be invoked to signal which windows should be merged.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.