[
https://issues.apache.org/jira/browse/CALCITE-6069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778817#comment-17778817
]
Ran Tao edited comment on CALCITE-6069 at 10/23/23 8:48 PM:
------------------------------------------------------------
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.
see:
https://github.com/apache/calcite/blob/c83ac69111fd9e75af5e3615af29a72284667a4a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L1193C28-L1193C28
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"".
think about this case:
{code:java}
Flink SQL> select array_aaa();
[ERROR] Could not execute SQL statement. Reason:
org.apache.calcite.sql.validate.SqlValidatorException: No match found for
function signature array_aaa()
{code}
Finally, I'm not sure it makes sense for flink to use spark library functions
was (Author: lemonjing):
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.
see:
https://github.com/apache/calcite/blob/c83ac69111fd9e75af5e3615af29a72284667a4a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L1193C28-L1193C28
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"".
think about this case:
{code:java}
Flink SQL> select array_aaa();
[ERROR] Could not execute SQL statement. Reason:
org.apache.calcite.sql.validate.SqlValidatorException: No match found for
function signature array_aaa()
{code}
> 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)