Statement grammar
Core script shapeTEXT
script := [WITH cte ("," cte)*]
output_statement (";" output_statement)* [";"]
cte := name AS "(" query ")"
output_statement :=
SELECT projection
INTO output_name
FROM input_or_cte [AS alias]
[TIMESTAMP BY field]
[WHERE condition]
[GROUP BY keys_and_optional_window]
[HAVING aggregate_condition]
[MATCH_RECOGNIZE (... ) AS alias]
[WINDOW BY keys_and_tumbling_window
COMPUTE assignments
[WHERE computed_condition]]Window syntax
| Syntax | Valid context |
|---|---|
TumblingWindow(Duration(unit, size)) | Aggregate GROUP BY, statistical WINDOW BY, temporal ML |
SlidingWindow(Duration(unit, size)) | Aggregate GROUP BY, temporal ML |
HoppingWindow(Duration(unit, size), Hop(unit, size)) | Aggregate GROUP BY, temporal ML |
SessionWindow(Duration(unit, timeout, maxDuration)) | Aggregate GROUP BY only |
Offset(unit, value) | Optional alignment argument on supported aggregate windows |
Function index
| Family | Functions |
|---|---|
| Scalar | ABS |
| Aggregate / statistics | COUNT, AVG, MIN, MAX, STDDEV, PERCENTILE, MEDIAN, MAD, REGRESSION_SLOPE, REGRESSION_INTERCEPT |
| MATCH navigation | PREV, FIRST, LAST; COUNT(*) as a match measure |
| ML feature | DIFF, AVG, MEAN, COUNT, STDDEV, ZSCORE |
| ML label | FUTURE |
| ML compute | CLASSIFY, PROBABILITY, CONFIDENCE, EXTRACT, PREDICT, RESIDUAL |
| Window metadata | Window.StartTime, Window.EndTime |
Important constraints
- Temporal windows, patterns, and ML require resolvable event time.
SessionWindowis valid only inGROUP BYand requires timeout plus maximum duration.- Statistical
WINDOW BY ... COMPUTEuses a tumbling window and preserves event rows. MATCH_RECOGNIZErequiresLIMIT, an alias,ONE ROW PER MATCH,AFTER MATCH SKIP TO NEXT ROW, and aDEFINEfor every named variable.- MATCH measure aggregation supports
COUNT(*); use navigation functions for repeated-variable values. - ML queries require
FEATURES,MODEL, andCOMPUTE; classifiers use labels and regressors use a target. - A projected non-aggregate field in an aggregate query must be a grouping key.