opensearch-project / opensearch-project/sql

[FEATURE] SQL query support for Analytics engine integration

Open
#5,248 5 comments 0 reactions 1 assignee View on GitHub

@dai-chen is already working on this.

Since Mar 23, 2026.

enhancement Meta SQL
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

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/_sql endpoint
  • 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:

  1. Enable Calcite SQL in unified query API: Add the Calcite native SQL parser path (SqlParserSqlValidatorSqlToRelConverterRelNode) in UnifiedQueryPlanner with proper SQL conformance, case sensitivity, and identifier handling
  2. Register full-text search functions: Register search functions (match, match_phrase, query_string) with same signatures and return types

SQL plugin:

  1. 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.
  2. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.