A language for data that moves
ChronusQL is a SQL-shaped language for transforming JSON event streams. It keeps familiar relational ideas, then adds explicit event time, temporal windows, ordered pattern recognition, per-event statistics, and online models.
A query reads a named stream with FROM, chooses event time with TIMESTAMP BY, transforms records, and writes results to a named stream with INTO. Queries can run over finite input or continue as new events arrive.
SELECT driver,
Window.EndTime AS window_end,
AVG(speed) AS average_speed
INTO output
FROM telemetry TIMESTAMP BY ts
WHERE speed > 0
GROUP BY driver, TumblingWindow(Duration(second, 10))
HAVING AVG(speed) >= 100Choose the result shape first
GROUP BY
Produces one aggregate result for each key and window. Use it for counts, totals, summaries, and KPIs.
GROUP BY driver, TumblingWindow(...)WINDOW BY ... COMPUTE
Keeps individual events and attaches window statistics to each event. Use it for scoring, anomaly filters, and contextual features.
WINDOW BY driver, TumblingWindow(...)
COMPUTE avg_speed = AVG(telemetry.speed)- Use a normal
SELECTfor row-by-row projection and filtering. - Use
GROUP BYfor aggregate rows, optionally bounded by event-time windows. - Use
WINDOW BY ... COMPUTEwhen the original event must remain in the result. - Use
MATCH_RECOGNIZEwhen order and repeated event roles define the result. - Use temporal ML clauses when features, labels, models, and predictions evolve with the stream.
Core guarantees
| Concern | ChronusQL behavior |
|---|---|
| Data | Each input record is a JSON object. Nested fields remain addressable by path. |
| Time | TIMESTAMP BY selects event time; otherwise the runtime uses arrival time. |
| State | Grouping keys partition aggregate, session, pattern, and model state. |
| Output | INTO names an output stream; scripts can produce several outputs. |
| Boundaries | Window metadata is available as Window.StartTime and Window.EndTime. |