Class TimeWindow
- java.lang.Object
-
- org.apache.flink.streaming.api.windowing.windows.Window
-
- org.apache.flink.streaming.api.windowing.windows.TimeWindow
-
@PublicEvolving public class TimeWindow extends Window
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TimeWindow.Serializer
The serializer used to write the TimeWindow type.
-
Constructor Summary
Constructors Constructor Description TimeWindow(long start, long end)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeWindow
cover(TimeWindow other)
Returns the minimal window covers both this window and the given window.boolean
equals(Object o)
long
getEnd()
Gets the end timestamp of this window.long
getStart()
Gets the starting timestamp of the window.static long
getWindowStartWithOffset(long timestamp, long offset, long windowSize)
Method to get the window start for a timestamp.int
hashCode()
boolean
intersects(TimeWindow other)
Returnstrue
if this window intersects the given window or if this window is just after or before the given window.long
maxTimestamp()
Gets the largest timestamp that still belongs to this window.static void
mergeWindows(Collection<TimeWindow> windows, MergingWindowAssigner.MergeCallback<TimeWindow> c)
Merge overlappingTimeWindow
s.String
toString()
-
-
-
Method Detail
-
getStart
public long getStart()
Gets the starting timestamp of the window. This is the first timestamp that belongs to this window.- Returns:
- The starting timestamp of this window.
-
getEnd
public long getEnd()
Gets the end timestamp of this window. The end timestamp is exclusive, meaning it is the first timestamp that does not belong to this window any more.- Returns:
- The exclusive end timestamp of this window.
-
maxTimestamp
public long maxTimestamp()
Gets the largest timestamp that still belongs to this window.This timestamp is identical to
getEnd() - 1
.- Specified by:
maxTimestamp
in classWindow
- Returns:
- The largest timestamp that still belongs to this window.
- See Also:
getEnd()
-
intersects
public boolean intersects(TimeWindow other)
Returnstrue
if this window intersects the given window or if this window is just after or before the given window.
-
cover
public TimeWindow cover(TimeWindow other)
Returns the minimal window covers both this window and the given window.
-
mergeWindows
public static void mergeWindows(Collection<TimeWindow> windows, MergingWindowAssigner.MergeCallback<TimeWindow> c)
Merge overlappingTimeWindow
s. For use by mergingWindowAssigners
.
-
getWindowStartWithOffset
public static long getWindowStartWithOffset(long timestamp, long offset, long windowSize)
Method to get the window start for a timestamp.- Parameters:
timestamp
- epoch millisecond to get the window start.offset
- The offset which window start would be shifted by.windowSize
- The size of the generated windows.- Returns:
- window start
-
-