You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A error returned to user in case if argument(s) are missing or have wrong type(s) is not user-friendly and usually confusing. As more signatures/arguments function has as less readable error become. See examples:
opensearchsql> SELECT PI(1);
{'reason': 'Invalid SQL query', 'details': 'pi function expected {[]}, but get [INTEGER]', 'type': 'ExpressionEvaluationException'}
opensearchsql> SELECT DATEDIFF();
{'reason': 'Invalid SQL query', 'details': 'datediff function expected {[DATE,DATE],[DATETIME,DATE],[DATE,DATETIME],[DATETIME,DATETIME],[DATE,TIME],[TIME,DATE],[TIME,TIME],[TIMESTAMP,DATE],[DATE,TIMESTAMP],[TIMESTAMP,TIMESTAMP],[TIMESTAMP,TIME],[TIME,TIMESTAMP],[TIMESTAMP,DATETIME],[DATETIME,TIMESTAMP],[TIME,DATETIME],[DATETIME,TIME]}, but get []', 'type': 'ExpressionEvaluationException'}
The goal is also to avoid such ugly messages like these:
For example, for DATEDIFF - DATEDIFF function gets two arguments of any datetime type, but for TIMEDIFF - TIMEDIFF function gets two arguments of any, but same datetime type.
Is your feature request related to a problem?
A error returned to user in case if argument(s) are missing or have wrong type(s) is not user-friendly and usually confusing. As more signatures/arguments function has as less readable error become. See examples:
The goal is also to avoid such ugly messages like these:
sql/opensearch/src/test/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilderTest.java
Lines 622 to 632 in d81ef73
What solution would you like?
Add new field to
FunctionResolver
to store argument/function description. It should be returned (if given) instead of default message, seesql/core/src/main/java/org/opensearch/sql/expression/function/DefaultFunctionResolver.java
Lines 65 to 68 in e04d6f8
What alternatives have you considered?
N/a
Do you have any additional context?
The text was updated successfully, but these errors were encountered: