Repository navigation
Open
Labels
Description
Is your feature request related to a problem?
The Analytics engine integration requires ANSI SQL support to enable SQL queries against non-Lucene indices. However, the unified query API currently only supports PPL V3. The PPL integration (tracked in the sibling issue) establishes the query routing, execution engine, and response formatting infrastructure — this issue covers the additional work needed for SQL support.
Technical requirements:
- ANSI SQL queries against non-Lucene indices return correct results through
_plugins/_sqlendpoint - SQL explain API (
_plugins/_sql/_explain) returns the logical plan - OpenSearch full-text search functions (
match,match_phrase,query_string) available in ANSI SQL syntax - Existing V2 SQL queries are unaffected (backward compatible, ANSI SQL is opt-in)
- Same response format, error handling, and observability as the PPL unified path
What solution would you like?
Unified query API:
- Enable Calcite SQL in unified query API: Add the Calcite native SQL parser path (
SqlParser→SqlValidator→SqlToRelConverter→RelNode) in UnifiedQueryPlanner with proper SQL conformance, case sensitivity, and identifier handling - Register full-text search functions: Register search functions (
match,match_phrase,query_string) with same signatures and return types
SQL plugin:
- Integrate with SQL REST endpoint: Add ANSI SQL mode routing in
RestSqlAction(via mode parameter or auto-detection) through the unified query pipeline established by the PPL issue, with explain support and backward compatibility for existing V2 SQL queries. - Integration tests: End-to-end ITs verifying ANSI SQL query, explain, full-text search functions, response format, and breaking changes in existing V2 SQL queries.What alternatives have you considered?
See parent issue #5246 for the design comparison of Option A (Query Delegation), Option B (Unified Query Pipeline), and Option C (Calcite Schema Adapter).
Do you have any additional context?
- PoC PR: dai-chen/sql-1#10 — demonstrates ANSI SQL RelNode generation via Calcite's native parser in UnifiedQueryPlanner
- Depends on PPL Analytics engine integration (sibling issue) for query routing, execution engine, and response formatting infrastructure
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
Activity
dai-chen commentedon Mar 30, 2026
Unified Query API — SQL Gap Analysis Report (Consolidated)
Date: 2026-03-30
Branch: https://github.com/dai-chen/sql-1/tree/poc/gap-analysis-on-formal
Scope: All SQL IT tests — V2 (
org.opensearch.sql.sql.*IT, 50 classes) + Legacy (org.opensearch.sql.legacy.*IT, 39 classes) — 807 queriesPipeline:
UnifiedQueryPlanner(Calcite native SQL parser) →UnifiedQueryCompiler→PreparedStatement.executeQuery()Moved to #5346 (comment).
penghuo commentedon Apr 1, 2026
All of them are bugs in V2, right?
2 remaining items
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path
Integrate SQL REST endpoint with analytics engine path (#5317)
feat(calcite): Add SqlExtension interface and Search Extension (non-g…
Integrate SQL REST endpoint with analytics engine path (opensearch-pr…
dai-chen commentedon May 19, 2026
Here is the gap analysis report based on the new SQL pipeline (SQL V2 parser +
CalciteRelNodeVisitor): https://github.com/dai-chen/sql-1/blob/sql-v2-calcite-gap-analysis/docs/report/sql-v2-calcite-gap-analysis.mdAfter all the PR merged above, below is the remaining gaps:
Major Gaps
SELECT * FROM nested_type e, e.message m) + NESTED functionvisitPaginateandvisitFetchCursorthrow unsupported. Includes B17 (fallback tests).visitTableFunctionis a stub. Implement KNN scan translation.Minor Gaps
tableFilteronly accepts STRING_LITERAL. Extend to accept ID.field=FUNC('arg')altSingleFieldRelevanceFunction. Extend grammar.01fails as ident. Workaround: backtick quoting.alias.*qualifiedStarrule toselectElement./type/typesuffix to table reference rule. (Already deprecated in OS)IFNULL(null, x)fails type resolution. ISNULL fixed.BIGINT; V2 returnsLONG. Map back intypeof()impl.visitScoreFunctionthrows unconditionally.visitHighlightFunctionthrows unconditionally.