Kirill Tkalenko created IGNITE-29115:
----------------------------------------

             Summary: SQL Calcite: Fix UDF/UDTF overload resolution for 
concrete and generic argument types
                 Key: IGNITE-29115
                 URL: https://issues.apache.org/jira/browse/IGNITE-29115
             Project: Ignite
          Issue Type: Bug
            Reporter: Kirill Tkalenko
            Assignee: Kirill Tkalenko


Calcite fails to resolve UDF overloads correctly when concrete SQL types 
coexist with a generic {{Object}} parameter ({{{}OTHER{}}}/{{{}ANY{}}}). Calls 
may fail with {{AssertionError: OTHER}} instead of invoking the matching 
overload.

Example:
{code:java}
@QuerySqlFunction
public String foo(String value) { return "String"; }

@QuerySqlFunction
public String foo(Timestamp value) { return "Timestamp"; }

@QuerySqlFunction
public String foo(Object value) { return "Object"; } {code}
Expected behavior:
{code:java}
SELECT UDF.FOO('text');                          -- String overload
SELECT UDF.FOO(TIMESTAMP '2024-01-02 03:04:05');  -- Timestamp overload
SELECT UDF.FOO(?);                               -- Object overload for a 
Person instance {code}
Resolve overloads by preferring the most specific compatible concrete type and 
using Object as a generic fallback. Support scalar and table functions, SQL 
literals, query parameters, nested function calls, and SQL expression chains 
based on the resulting argument type.



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

Reply via email to