@PublicEvolving public class TimeWindow extends Window
Modifier and Type | Class and Description |
---|---|
static class |
TimeWindow.Serializer
The serializer used to write the TimeWindow type.
|
Constructor and Description |
---|
TimeWindow(long start,
long end) |
Modifier and Type | Method and 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)
Returns
true 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 overlapping
TimeWindow s. |
String |
toString() |
public long getStart()
public long getEnd()
public long maxTimestamp()
This timestamp is identical to getEnd() - 1
.
maxTimestamp
in class Window
getEnd()
public boolean intersects(TimeWindow other)
true
if this window intersects the given window or if this window is just
after or before the given window.public TimeWindow cover(TimeWindow other)
public static void mergeWindows(Collection<TimeWindow> windows, MergingWindowAssigner.MergeCallback<TimeWindow> c)
TimeWindow
s. For use by merging WindowAssigners
.public static long getWindowStartWithOffset(long timestamp, long offset, long windowSize)
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.Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.