[ 
https://issues.apache.org/jira/browse/CALCITE-6037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17772558#comment-17772558
 ] 

Julian Hyde commented on CALCITE-6037:
--------------------------------------

Can you describe the problem in the first paragraph, rather than giving me a 
screen full of code to read? This is related to my perpetual rant that people 
describe the fix rather than the problem. Just say what the category is and 
what it should be. No code necessary. Maybe mention that the function they all 
used doesn’t have a category argument, so it’s easy to make mistakes. 

> The function category of ARRAY/EXTRACT_VALUE/XML_TRANSFORM/EXTRACT/EXISTSNODE 
> is incorrect
> ------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6037
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6037
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: Ran Tao
>            Assignee: Ran Tao
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.36.0
>
>
> In SqlLibraryOperators, we defined some SqlFunctions like below:
> {code:java}
> @LibraryOperator(libraries = {SPARK})
> public static final SqlFunction ARRAY =
>     SqlBasicFunction.create("ARRAY",
>         SqlLibraryOperators::arrayReturnType,
>         OperandTypes.SAME_VARIADIC);
> {code}
> {code:java}
> public static final SqlFunction EXTRACT_VALUE =
>     SqlBasicFunction.create("EXTRACTVALUE",
>         ReturnTypes.VARCHAR_2000.andThen(SqlTypeTransforms.FORCE_NULLABLE),
>         OperandTypes.STRING_STRING); {code}
> {code:java}
> public static final SqlFunction XML_TRANSFORM =
>     SqlBasicFunction.create("XMLTRANSFORM",
>         ReturnTypes.VARCHAR.andThen(SqlTypeTransforms.FORCE_NULLABLE),
>         OperandTypes.STRING_STRING); {code}
> however, they used a simplified constructor of SqlBasicFunction by set 
> function category to Numeric forever.
> {code:java}
> /** Creates a {@code SqlBasicFunction}
>  * with kind {@link SqlKind#OTHER_FUNCTION}
>  * and category {@link SqlFunctionCategory#NUMERIC}. */
> public static SqlBasicFunction create(String name,
>     SqlReturnTypeInference returnTypeInference,
>     SqlOperandTypeChecker operandTypeChecker) {
>   return new SqlBasicFunction(name, SqlKind.OTHER_FUNCTION,
>       SqlSyntax.FUNCTION, true, returnTypeInference, null,
>       OperandHandlers.DEFAULT, operandTypeChecker, 0,
>       SqlFunctionCategory.NUMERIC, call -> SqlMonotonicity.NOT_MONOTONIC);
> } {code}
> We should use constructor with SqlFunctionCategory to correct their category.



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

Reply via email to