Class TimeWindow
- java.lang.Object
-
- org.apache.kafka.streams.kstream.Window
-
- org.apache.kafka.streams.kstream.internals.TimeWindow
-
public class TimeWindow extends Window
ATimeWindow
covers a half-open time interval with its start timestamp as an inclusive boundary and its end timestamp as exclusive boundary. It is a fixed size window, i.e., all instances (of a singlewindow specification
) will have the same size.For time semantics, see
TimestampExtractor
.- See Also:
SessionWindow
,UnlimitedWindow
,TimeWindows
,TimestampExtractor
-
-
Constructor Summary
Constructors Constructor Description TimeWindow(long startMs, long endMs)
Create a new window for the given start time (inclusive) and end time (exclusive).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
overlap(Window other)
Check if the given window overlaps with this window.
-
-
-
Constructor Detail
-
TimeWindow
public TimeWindow(long startMs, long endMs) throws IllegalArgumentException
Create a new window for the given start time (inclusive) and end time (exclusive).- Parameters:
startMs
- the start timestamp of the window (inclusive)endMs
- the end timestamp of the window (exclusive)- Throws:
IllegalArgumentException
- ifstartMs
is negative or ifendMs
is smaller than or equal tostartMs
-
-
Method Detail
-
overlap
public boolean overlap(Window other) throws IllegalArgumentException
Check if the given window overlaps with this window.- Specified by:
overlap
in classWindow
- Parameters:
other
- another window- Returns:
true
ifother
overlaps with this window—false
otherwise- Throws:
IllegalArgumentException
- if theother
window has a different type thanthis
window
-
-