public class TimeWindows extends Windows<TimeWindow>
The semantics of a time-based window are: Every T1 (advance) time-units, compute the aggregate total for T2 (size) time-units.
advance < size
a hopping windows is defined: advance == size
a tumbling window is defined:Modifier and Type | Field and Description |
---|---|
long |
advance
The size of the window's advance interval, i.e.
|
long |
size
The size of the window, i.e.
|
Modifier and Type | Method and Description |
---|---|
TimeWindows |
advanceBy(long interval)
Returns a window definition with the original size, but advance ("hop") the window by the given
interval, which specifies by how much a window moves forward relative to the previous one.
|
boolean |
equals(Object o) |
int |
hashCode() |
static TimeWindows |
of(long size)
Returns a window definition with the given window size, and with the advance interval being
equal to the window size.
|
long |
size() |
Map<Long,TimeWindow> |
windowsFor(long timestamp)
Creates all windows that contain the provided timestamp, indexed by non-negative window start timestamps.
|
maintainMs, segments, until
public final long size
TimestampExtractor
.public final long advance
TimestampExtractor
.public static TimeWindows of(long size)
size
- The size of the window, with the requirement that size > 0.
The window size's effective time unit is determined by the semantics of the
topology's configured TimestampExtractor
.public TimeWindows advanceBy(long interval)
interval
- The advance interval ("hop") of the window, with the requirement that
0 < interval ≤ size. The interval's effective time unit is
determined by the semantics of the topology's configured
TimestampExtractor
.public Map<Long,TimeWindow> windowsFor(long timestamp)
Windows
windowsFor
in class Windows<TimeWindow>
timestamp
- the timestamp window should get created forwindowStartTimestamp -> Window
entries