Martijn Visser created FLINK-41814:
--------------------------------------
Summary: Named arguments of a scalar function get no implicit cast
Key: FLINK-41814
URL: https://issues.apache.org/jira/browse/FLINK-41814
Project: Flink
Issue Type: Bug
Components: Table SQL / Planner
Affects Versions: 2.2.1, 2.3.0, 2.1.1, 1.20.3, 2.0.1, 2.4.0, 2.5.0
Reporter: Martijn Visser
Calling a scalar function with a named argument fails when the argument needs
an implicit cast, while the same call with a positional argument works. For a
function with {{eval(@ArgumentHint(name = "x", type = @DataTypeHint("BIGINT"))
Long x)}} registered as {{f}}:
{code:sql}
SELECT f(1); -- 1
SELECT f(x => 1); -- fails
SELECT f(x => CAST(1 AS BIGINT)); -- 1
{code}
>From 2.0.1 to 2.3.0 and on master, {{f(x => 1)}} fails with
>{{CodeGenException: Mismatch of function's argument data type 'BIGINT' and
>actual argument type 'INT NOT NULL'.}} On 1.20.3 it fails with
>{{ValidationException: Could not infer an output type for the given
>arguments.}} A DECIMAL(10, 2) argument called with {{d => 1.5}} fails the same
>way. We should apply the same implicit casts to named arguments as to
>positional ones.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)