Bonnie Varghese created CALCITE-6069:
----------------------------------------

             Summary: Matching functions without arguments are reported as 
UKNOWN functions
                 Key: CALCITE-6069
                 URL: https://issues.apache.org/jira/browse/CALCITE-6069
             Project: Calcite
          Issue Type: Improvement
            Reporter: Bonnie Varghese


In Flink, when I run a function without arguments I get the following error:
{code:java}
Flink SQL> SELECT ARRAY_JOIN(); [ERROR] Could not execute SQL statement. 
Reason: org.apache.calcite.sql.validate.SqlValidatorException: No match found 
for function signature ARRAY_JOIN{code}
The function (handleUnresolvedFunction) 
[https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L1982]
 only deals with Invalid number of arguments and rest is classified as Unknown 
functions.
However, if the validation can report it as a No match found for function 
signature and the expected signatures, it can help getting started with 
functions without going to read the documentation.

So, the proposal is to add a new CalciteException for No Function Match similar 
to validatorUnknownFunction  
[https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java#L141]
 and use that to improve the error message as follows:



Suggested improved error message:
{code:java}
Flink SQL> SELECT ARRAY_JOIN();
[ERROR] Could not execute SQL statement. Reason:
org.apache.calcite.sql.validate.SqlValidatorException: No match found for 
function signature ARRAY_JOIN().
Supported signatures are:
ARRAY_JOIN(ARRAY<STRING>, <CHARACTER_STRING>)
ARRAY_JOIN(ARRAY<STRING>, <CHARACTER_STRING>, <CHARACTER_STRING>){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to