opensearch-project / opensearch-project/sql

[BUG] Deprecation of OpenSearch DSL format has affected the behavior of the explain API

Open
#4,373 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What is the bug?
Deprecation of OpenSearch DSL format has affected the behavior of the explain API
https://github.com/opensearch-project/sql/issues/3280

Prior to OpenSearch 3.0 we could request DSL syntax using the following query:

POST /_plugins/_sql/_explain?format=json
{"query":"SELECT Shape, _id FROM railroads LIMIT 0,10000"}

result:

{
  "from": 0,
  "size": 10000,
  "_source": {
    "includes": [
      "Shape",
      "_id"
    ],
    "excludes": []
  }
}

With 3.0 we have noticed a couple of issues with our workflow.

  1. using format=json returns an error when used with explain API
{
  "error": {
    "reason": "Invalid SQL query",
    "details": "Failed to create executor due to unknown response format: json",
    "type": "IllegalArgumentException"
  },
  "status": 400
}
  1. if we dont use format=json then we run into issues with including a geoshape column
POST /_plugins/_sql/_explain
{"query":"SELECT Shape, _id FROM railroads LIMIT 0,10000"}
{
  "error": {
    "reason": "Invalid SQL query",
    "details": "can't resolve Symbol(namespace=FIELD_NAME, name=Shape) in type env",
    "type": "SemanticCheckException"
  },
  "status": 400
}

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.

Research direction

Start at the SQL explain API endpoint and trace handling for the format=json request and for geoshape field resolution. Compare the documented pre-3.0 behavior with the two OpenSearch 3.0 failures; the work is done when both example explain requests produce valid results without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
api, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.