Skip to main content

Time Windows & Aggregations

Windows group messages by time intervals for aggregation. Instead of reacting to every individual message, windows let you ask questions like “How many orders in the last 5 minutes?” or “What’s the average temperature over a rolling 10-minute window?”

Window Types

LiteJoin supports three window types:

Tumbling Windows

Fixed-size, non-overlapping intervals. Each message belongs to exactly one window. When the window closes, the aggregation fires and results are emitted.
Best for: periodic reports, batch-style aggregations, non-overlapping summaries.

Sliding Windows

Fixed-size intervals that slide forward by a configurable step. Messages may appear in multiple windows.
Best for: moving averages, trend detection, smoothed metrics.

Session Windows

Dynamic intervals based on activity gaps. A session starts with the first message and closes when no new messages arrive within the gap duration.
Best for: user sessions, burst detection, grouping related events.

Configuration

Common Fields

Type-Specific Fields

Result Format

Window results are emitted as JoinResult objects, the same format as join results:

Combining Windows with Joins

You can use window aggregations as inputs to joins. For example, aggregate orders per region, then join with region metadata:

Best Practices

  1. Choose the right window type. Tumbling for periodic reports, sliding for moving averages, session for activity-based grouping.
  2. Keep size reasonable. Larger windows hold more data in memory. Start with 5–15 minute windows.
  3. Use GROUP BY for segmentation. Split aggregations by a dimension (region, user type, status) for richer insights.
  4. Test with Studio. Use the visual windowing controls in LiteJoin Studio to experiment without writing complex config.