opensearch-project / opensearch-project/sql

[BUG] Internal server error on incorrect syntax

Open
#3,058 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug catch-all acknowledged error-experience SQL
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

Description

What is the bug?

{
    "datasource" : "mys3",
    "lang" : "sql",
    "query" : "ALTER MATERIALIZED VIEW mys3.default.`mv-v10` WITH (auto_refresh = false)"
}

{
  "status": 500,
  "error": {
    "type": "SyntaxCheckException",
    "reason": "There was internal problem at backend",
    "details": "Failed to parse query due to offending symbol [MATERIALIZED] at: \u0027ALTER MATERIALIZED\u0027 \u003c--- HERE... More details: Expecting tokens in {\u0027(\u0027, \u0027ADD\u0027, \u0027ALTER\u0027, \u0027ANALYZE\u0027, \u0027CACHE\u0027, \u0027CALL\u0027, \u0027CLEAR\u0027, \u0027COMMENT\u0027, \u0027COMMIT\u0027, \u0027CREATE\u0027, \u0027DECLARE\u0027, \u0027DELETE\u0027, \u0027DESC\u0027, \u0027DESCRIBE\u0027, \u0027DFS\u0027, \u0027DROP\u0027, \u0027EXPLAIN\u0027, \u0027EXPORT\u0027, \u0027FROM\u0027, \u0027GRANT\u0027, \u0027IMPORT\u0027, \u0027INSERT\u0027, \u0027LIST\u0027, \u0027LOAD\u0027, \u0027LOCK\u0027, \u0027MAP\u0027, \u0027MERGE\u0027, \u0027MSCK\u0027, \u0027REDUCE\u0027, \u0027REFRESH\u0027, \u0027REPAIR\u0027, \u0027REPLACE\u0027, \u0027REVOKE\u0027, \u0027ROLLBACK\u0027, \u0027SELECT\u0027, \u0027SET\u0027, \u0027SHOW\u0027, \u0027START\u0027, \u0027TABLE\u0027, \u0027EXECUTE\u0027, \u0027TRUNCATE\u0027, \u0027UNCACHE\u0027, \u0027UNLOCK\u0027, \u0027UPDATE\u0027, \u0027USE\u0027, \u0027VALUES\u0027, \u0027WITH\u0027}"
  }
}

Expectation
return 400 validation exception

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 by reproducing the shown SQL validation request and trace how SyntaxCheckException is converted into the HTTP response. Done means this malformed ALTER MATERIALIZED VIEW request returns a 400 validation exception instead of a 500 internal server error; no file or test location is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
api, backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.