You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Ran Tao (Jira)" <ji...@apache.org> on 2023/10/23 20:28:00 UTC
[jira] [Commented] (CALCITE-6069) Matching function without arguments are reported as UKNOWN function
[ https://issues.apache.org/jira/browse/CALCITE-6069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778817#comment-17778817 ]
Ran Tao commented on CALCITE-6069:
----------------------------------
Frankly speaking, even if you give the correct method signature and the user uses it according to your method signature, it still won't work. Because ARRAY_JOIN in your example is a function of the Spark Library and is not enabled by default. Therefore, calcite cannot lookup more information. In fact, when spark is activated, its error message is "Invalid number of arguments to function 'ARRAY_JOIN'. Was expecting 2 arguments"".
> Matching function without arguments are reported as UKNOWN function
> -------------------------------------------------------------------
>
> Key: CALCITE-6069
> URL: https://issues.apache.org/jira/browse/CALCITE-6069
> Project: Calcite
> Issue Type: Improvement
> Reporter: Bonnie Varghese
> Priority: Major
>
> 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(validatorNoMatchFunction) 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)