Repository navigation
Tracking: SQL query parsing and matching support #822
Copy link
Copy link
Open
Description
Tracks SQL query shapes we want ASAPQuery to support, using the PromQL compliance suites as the reference set. Coverage is checked by the SQL query support runner (#823) (asap-query-engine/tests/sql_query_support.rs), which plans each query and builds the engine execution context without executing it. Its suites mirror promql-compliance/suites case-for-case.
Supported today
- Single-layer
SUM/COUNT/MIN/MAX/QUANTILE/COUNT(DISTINCT col)withGROUP BY, e.g.sum by (job) (sum_over_time(data[5m])) - Time range as
BETWEENor half-open>= ... <, relative (NOW()) or absolute - Global top-k by
SUMorCOUNT:ORDER BY <alias> DESC LIMIT k
Unsupported shapes
- sql: aggregation without GROUP BY is rejected #817 Aggregation without
GROUP BY, e.g.sum(data),quantile(0.5, m),histogram_quantile(...) - sql: per-group top-k (LIMIT k BY cols) is rejected #818 Per-group top-k (
LIMIT k BY cols), e.g.topk by (job) (3, ...) - sql: two-layer nested aggregation (subquery in FROM) is rejected #819 Two-layer nested aggregation, e.g.
sum by (job) (sum by (job, instance) (data)) - sql: outer SELECT without an aggregate over a subquery is rejected #820 Outer SELECT without an aggregate over a subquery, e.g.
topk by (job) (3, sum by (job, instance) (data)) - sql: ORDER BY / LIMIT inside a FROM subquery is silently dropped #821
ORDER BY/LIMITinside a subquery is silently dropped - sql: ORDER BY / LIMIT on the outer layer of a two-layer query is rejected #891
ORDER BY/LIMITon the outer layer of a two-layer query, e.g.topk(5, sum by (job) (sum by (job, instance) (data))) - Three or more nested layers, e.g.
sum by (job) (avg by (job) (sum by (job, instance) (data))). Only one subquery level is parsed. -
AVG: planned as Sum + Count, but the engine only resolves single-statistic SQL queries - Arithmetic in the projection, e.g.
SUM(value) / COUNT(value),SUM(value) + 1,QUANTILE(0.9, value) / QUANTILE(0.5, value) - More than one aggregate in a SELECT, e.g.
SUM(value), COUNT(value) -
COUNT(*)
No SQL equivalent yet (not in the SQL suites)
- Counter
rate()/increase() - PromQL subqueries over time, e.g.
max_over_time((sum(m))[10m:]) - Bare selector (raw samples), e.g.
user_service_cache_refresh_lag_seconds
Intentionally rejected
- Closed
<=upper time bound: only half-open[start, end)ranges match ClickHouse's scan - No time filter
Reactions are currently unavailable
Activity
[-]Tracking: SQL query support[/-][+]Tracking: SQL query parsing and matching support[/+]