You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subqueries.IN (subquery), EXISTS, and a scalar subquery in the select list all hit the same expr.rs:191 rejection. Uncorrelated cases (IN, scalar) reduce to a semi-join / broadcast scalar and are the tractable subset; correlated EXISTS is materially harder. Note that derived tables (FROM (SELECT …)) and WITHdo lower today — this is specifically about subqueries in expression position. See also SQL: derived-table joins silently degenerate to a cross product #66 (derived-table joins → cross product), now closed.
median is the interesting one for this project: it is exactly AggIntent::Quantile { q: 0.5 }, which the lowerer already emits for approx_percentile_cont (which does lower). Mapping median onto it is close to a one-liner and directly feeds the sketch path.
array_agg — WONTFIX (decided 2026-07-09). It does not pre-aggregate (output is O(input rows)), has no bounded-memory approximate form, and its partial state is the data, so "mergeable" means nothing for it. plan::boundary::realize is an exhaustive match over AggIntent, so adding a variant would force boundary, bind and schema derivation to each handle it — and every answer would be PassThrough. It also appears in neither SQL corpus. unsupported aggregate: array_agg is the intended behaviour. See the comment below.
Aside, not filed: SELECT SUM(x) FILTER (WHERE …) fails earlier, inside DataFusion 43's parser (ParserError("Expected end of statement, found: (")), so it is not our rejection to fix.
Summary
Three structural SQL features are rejected by the lowerer. Grouped because each is individually small; split out if any one is prioritized.
Like #110, none of these are exercised by the existing SQL corpus tests, which pass.
Reproduction
Against the
netflow_table/hostscatalog:Location
crates/frontend-sql/src/sql/expr.rs:191—subquery-valued expression in predicatecrates/frontend-sql/src/sql/mod.rs:106—LogicalPlan::Subquery(_)crates/frontend-sql/src/sql/mod.rs:82—Distinct::On(_)crates/frontend-sql/src/sql/mod.rs:469—UnsupportedAggregate(name)Notes
IN (subquery),EXISTS, and a scalar subquery in the select list all hit the sameexpr.rs:191rejection. Uncorrelated cases (IN, scalar) reduce to a semi-join / broadcast scalar and are the tractable subset; correlatedEXISTSis materially harder. Note that derived tables (FROM (SELECT …)) andWITHdo lower today — this is specifically about subqueries in expression position. See also SQL: derived-table joins silently degenerate to a cross product #66 (derived-table joins → cross product), now closed.medianis the interesting one for this project: it is exactlyAggIntent::Quantile { q: 0.5 }, which the lowerer already emits forapprox_percentile_cont(which does lower). Mappingmedianonto it is close to a one-liner and directly feeds the sketch path.array_agg— WONTFIX (decided 2026-07-09). It does not pre-aggregate (output is O(input rows)), has no bounded-memory approximate form, and its partial state is the data, so "mergeable" means nothing for it.plan::boundary::realizeis an exhaustive match overAggIntent, so adding a variant would forceboundary,bindand schema derivation to each handle it — and every answer would bePassThrough. It also appears in neither SQL corpus.unsupported aggregate: array_aggis the intended behaviour. See the comment below.DISTINCT ONis Postgres-flavoured "first row per group" — it overlaps with the partitioned-topk work in SQL: partitioned topk (top-k per group via window functions) is unsupported #24.SELECT SUM(x) FILTER (WHERE …)fails earlier, inside DataFusion 43's parser (ParserError("Expected end of statement, found: (")), so it is not our rejection to fix.