Skip to content

Sql v2 calcite gap analysis#21

Draft
dai-chen wants to merge 5 commits into
mainfrom
sql-v2-calcite-gap-analysis
Draft

Sql v2 calcite gap analysis#21
dai-chen wants to merge 5 commits into
mainfrom
sql-v2-calcite-gap-analysis

Conversation

@dai-chen
Copy link
Copy Markdown
Owner

Description

[Describe what this change achieves]

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff or -s.
  • Public documentation issue/PR created.

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.

dai-chen added 5 commits May 12, 2026 08:52
Bridge SQL V2 parser output to PPL V3's CalciteRelNodeVisitor path:
- QueryService.shouldUseCalcite() accepts QueryType.SQL
- CalciteRelNodeVisitor handles Alias expression in project list
- OpenSearchExecutionEngine returns Cursor.None instead of null
- Disable REST-level V2-to-legacy fallback to expose all gaps
- Enable Calcite + disallow fallback in SQL IT test base class

These are temporary changes for gap analysis, not production-ready.
Comprehensive gap analysis for Mustang SQL design decision:
- 572/964 tests pass (59.3%) with V2 AST routed through Calcite
- Category A: 13 grammar gaps (JOINs, IN/EXISTS, UNION, etc.)
- Category B: 20 visitor gaps (ArgumentMap NPE, AggFunc cast, etc.)
- Quick wins identified: ~158 tests unlockable with S-effort fixes
- Verified against grammar, AST builder, and visitor source code
- Null-check BUCKET_NULLABLE in visitAggregation (B1)
- Handle AggregateFunction in visitWindowFunction (B2)
- Add visitLimit override for SQL LIMIT clause (B8)
- Add RANK/DENSE_RANK/ROW_NUMBER to WINDOW_FUNC_MAPPING (B9)
- Fix table name resolution to pass single-element list (B10)
- Register relevance function aliases: MATCH_QUERY, MATCHQUERY, etc (B7)
- Register ISNULL, fix IFNULL to use ENHANCED_COALESCE (B14)
- Add joinClause and joinType rules to fromClause
- Add UNION ALL / EXCEPT to selectStatement
- Add IN subquery predicate alternative
- Add EXISTS expression atom
- Default AstBuilder throws SyntaxCheckException (preserves legacy fallback)
- Add createExpressionBuilder() factory for subclass override
- Make visitAstExpression protected for subclass access
…ISTS)

Demonstrates the pattern: override AstBuilder in SQLService to build
AST nodes for features gated in the default path. In production, this
override moves to the unified query API's CustomVisitorStrategy.

QueryService.shouldUseCalcite() temporarily accepts SQL for PoC testing.
This flag is not for production — SQL should route through unified query
API (RestUnifiedQueryAction) in the final integration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant