Support the rest of Druid's pipe syntax #135
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 616 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.384
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #135"
general
weight: 0.35
gianm
Summary
Adds more pipe syntax.
|> AGGREGATE COUNT() DESCused to parse withDESCas an alias, sounpipe()printedCOUNT() AS DESC. Order-suffixed items are nowSqlOrderByExpressions, which is why that class is now anSqlExpression.unpipe()converts every new form (and bareFROMqueries nested anywhere), e.g.|> UNION DISTINCT (q)becomesSELECT DISTINCT FROM (... UNION ALL q), and AGGREGATE order suffixes become anORDER BY.Pipes now bind to everything before them:
unpipe()keeps the WITH on the outermost SELECT, so CTEs stay visible after a pipe forces a sub query:WITH c AS (SELECT FROM t) SELECT FROM (... GROUP BY k) WHERE k IN (SELECT k FROM c).removePipeOperatorgives the WITH back to the starting query.SqlPipesQuery.createtakes the WITH off aSqlQueryroot, so built and parsed trees match.Evidence
Expected "AGGREGATE", "DROP", ...), exceptAGGREGATE ... DESC, which misparses.After: all parse and round-trip.
SELECT a FROM t UNION ALL SELECT a FROM u |> AGGREGATE COUNT() AS cparsed as aSqlQuerywith the pipes on its second query, which unpiped toSELECT a FROM t UNION ALL SELECT COUNT() AS c FROM (SELECT a FROM u).After:
SELECT COUNT() AS c FROM (SELECT a FROM t UNION ALL SELECT a FROM u).WITH c AS (FROM t) FROM c |> AGGREGATE COUNT() AS n GROUP BY k |> WHERE k IN (FROM c)unpiped toSELECT FROM (WITH c ... GROUP BY k) WHERE k IN (SELECT FROM c), wherecis out of scope.After:
WITH c AS (SELECT FROM t) SELECT FROM (SELECT k, COUNT() AS n FROM c GROUP BY k) WHERE k IN (SELECT * FROM c).npm test: 3094 tests pass (eslint, prettier, snapshot indent, jest). Nested-paren parse times unchanged vs master.Merge Danger
Door: two-way until released, one-way after
Reverting the PR is cheap; once the changesets release goes out, the
SqlFromQueryAPI change is published (changeset isminor, as #133 was).Blast Radius: consumers
SqlFromQuery.table,getTableName,changeTable,changeTableName,getNamespaceNameandchangeNamespaceare gone; usefromClauseand the FROM clause methods.SqlOrderByExpressionnow passesinstanceof SqlExpression, so walkers that branch on that will see ORDER BY items too.(, so some parse error messages for parenthesized input change.|> AGGREGATE x DESC/GROUP BY x DESCnow parse to aSqlOrderByExpressioninstead of aSqlAliasnamedDESC.A UNION ALL B |> ...the pipes moved fromBto aSqlPipesQueryaround the whole union, and a leading WITH moved from the root query toSqlPipesQuery.withClause. Code that reads those trees sees a different shape.... |> op UNION ALL ...no longer parses, and aSqlPipesQuerythrows if given aunionQuery.🤖 Generated with Claude Code