Extend V2 SQL parser with JOIN/UNION/MINUS for unified query path#5444
Extend V2 SQL parser with JOIN/UNION/MINUS for unified query path#5444dai-chen wants to merge 3 commits into
JOIN/UNION/MINUS for unified query path#5444Conversation
Extend V2 ANTLR grammar with JOIN, UNION (ALL/DISTINCT), and MINUS rules. Add ExtendedAstBuilder in SqlV2QueryParser to produce AST nodes for the Calcite-based unified query path. The base AstBuilder throws SyntaxCheckException to preserve legacy engine fallback. Signed-off-by: Chen Dai <daichen@amazon.com>
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 45a0e3b.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
PR Reviewer Guide 🔍(Review updated until commit 1fc2dac)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 1fc2dac Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 45a0e3b
Suggestions up to commit ebbee64
|
Add grammar rules (inSubqueryPredicate, existsSubqueryExpressionAtom) and wire them through ExtendedAstExpressionBuilder to produce InSubquery and ExistsSubquery AST nodes. Base AstExpressionBuilder throws SyntaxCheckException to preserve legacy engine fallback. Also simplify joinClause by inlining join types (no separate joinType rule) and make AstBuilder.expressionBuilder overridable via factory method. Signed-off-by: Chen Dai <daichen@amazon.com>
|
Persistent review updated to latest commit 45a0e3b |
- Add inSubqueryPredicate and existsSubqueryExpressionAtom grammar rules - Add ExtendedAstExpressionBuilder for subquery AST construction - Base AstExpressionBuilder throws SyntaxCheckException for fallback - Add unifySchema flag to Union: false for SQL (positional), true for PPL (schema merge via SchemaUnifier) - Remove SchemaUnifier from visitMinus (SQL-only, always positional) - Inline joinType into joinClause, use switch in toJoinType - Add AstDSL.inSubquery() and existsSubquery() - Add LegacyFallbackIT for JOIN and IN subquery fallback Signed-off-by: Chen Dai <daichen@amazon.com>
|
Persistent review updated to latest commit 1fc2dac |
Description
Extend the V2 SQL ANTLR grammar and add
ExtendedAstBuilderto supportJOIN(INNER/LEFT/RIGHT/CROSS),UNION(ALL/DISTINCT), andMINUSin the unified Calcite-based query path. The baseAstBuildercontinues to throw SyntaxCheckException for these statements, preserving the legacy engine fallback in production.Notes
LogicalSystemLimitnoise in logical plansCalciteRelNodeVisitorbecause SQL V2AstBuilderalways wraps select items which breaks UNION/MINUS with explicit select listsPlanned PRs
CalciteRelNodeVisitorissues identified during V2 AST integrationRelated Issues
Part of #5248
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.