[ 
https://issues.apache.org/jira/browse/CALCITE-7845?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirill Tkalenko updated CALCITE-7845:
-------------------------------------
    Summary: UDF/UDTF overload resolution fails when concrete parameter types 
coexist with ANY  (was: Fix UDF/UDTF overload resolution with generic parameter 
types)

> UDF/UDTF overload resolution fails when concrete parameter types coexist with 
> ANY
> ---------------------------------------------------------------------------------
>
>                 Key: CALCITE-7845
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7845
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Kirill Tkalenko
>            Assignee: Kirill Tkalenko
>            Priority: Major
>              Labels: pull-request-available
>
> Calcite may throw an {{AssertionError}} when resolving overloaded 
> user-defined functions that combine concrete parameter types with {{Object}} 
> ({{{}ANY{}}}).
> Example:
> {code:java}
> public static String foo(String value) { return "String"; }
> public static String foo(Timestamp value) { return "Timestamp"; }
> public static String foo(Object value) { return "Object"; } {code}
> After registering these overloads under the same SQL name:
> {code:java}
> SELECT foo('text');                          -- expected: String
> SELECT foo(TIMESTAMP '2024-01-02 03:04:05');  -- expected: Timestamp
> SELECT foo(TRUE);                            -- expected: Object {code}
> Expected behavior: prefer a compatible concrete overload and use Object as a 
> fallback, regardless of registration order. Apply the same behavior to scalar 
> UDFs and table functions (UDTFs).



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

Reply via email to