opensearch-project / opensearch-project/sql

[FEATURE] Include expression in message when expression evaluation throws an exception

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

Nobody has claimed this yet.

enhancement error-experience 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?
When evaluating an expression and it throws an exception, the message does not include the expression that failed. A query may contain many expressions, so it can be unclear to the user which expression they need to fix.

What solution would you like?
Include the failing expression or sub expression in the message of the exception that is thrown.

What alternatives have you considered?
Point to the position in the input query where the failing expression is found.

Do you have any additional context?
Example query and error:

SELECT x, ABS(y) FROM test2;
{
  "error": {
    "reason": "Invalid SQL query",
    "details": "invalid to get longValue from value of type ARRAY",
    "type": "ExpressionEvaluationException"
  },
  "status": 400
}

As you can see, it is unclear that the problem is from ABS(y).

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 example query and tracing the Java expression-evaluation exception path in the SQL engine. Identify where the failing expression becomes an ExpressionEvaluationException; done means the error message identifies the expression or subexpression that caused the failure, with relevant tests covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.