opensearch-project / sql

Query your data using familiar SQL or intuitive Piped Processing Language (PPL)
https://opensearch.org/docs/latest/search-plugins/sql/index/
Apache License 2.0
121 stars 140 forks source link

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

Open normanj-bitquill opened 3 weeks ago

normanj-bitquill commented 3 weeks ago

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).

andrross commented 4 days ago

[Catch All Triage - 1, 2, 3, 4, 5]