Interface WindowAssigner
- All Known Implementing Classes:
WindowAssigner.Natural, WindowAssigner.Raw, WindowAssigner.Tumbling
public sealed interface WindowAssigner
permits WindowAssigner.Tumbling, WindowAssigner.Raw, WindowAssigner.Natural
Maps an event timestamp to the start of its window. Implementations are pure:
assignWindow(long) depends only on its input and the assigner's fields, so concurrent shards
compute identical window keys without coordination.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordEngine-suggested window size for aggregated queries with no explicit window, for example(endMs - startMs) / returnSize.static final recordEvery event is its own window; for raw queries.static final recordFixed-size, non-overlapping windows aligned tostartMs. -
Method Summary
Modifier and TypeMethodDescriptionlongassignWindow(long timestamp) Assigns a timestamp to the start of its window.static WindowAssignerfrom(DataPointQueryOptions<?> opts) Builds the assigner for the given query options:WindowAssigner.RawforRawQueryOptions,WindowAssigner.TumblingforAggregatedQueryOptions.longReturns the window size in milliseconds;0means one window per event and onlyWindowAssigner.Rawreturns it.
-
Method Details
-
assignWindow
long assignWindow(long timestamp) Assigns a timestamp to the start of its window.- Parameters:
timestamp- the event timestamp in epoch milliseconds- Returns:
- the window start in epoch milliseconds;
WindowAssigner.Rawreturns the input
-
windowSize
long windowSize()Returns the window size in milliseconds;0means one window per event and onlyWindowAssigner.Rawreturns it. -
from
Builds the assigner for the given query options:WindowAssigner.RawforRawQueryOptions,WindowAssigner.TumblingforAggregatedQueryOptions.WindowAssigner.Naturalis for engines that construct it directly.- Parameters:
opts- the query options- Returns:
- the matching assigner
- Throws:
IllegalArgumentException- ifoptsis an aggregated query without a time range
-