[
https://issues.apache.org/jira/browse/FLINK-41787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155056#comment-18155056
]
yongfu.gao commented on FLINK-41787:
------------------------------------
I reproduced this: FunctionGenerator registered ATAN2 only for (DOUBLE, DOUBLE)
and (DECIMAL, DECIMAL), so calls with one DECIMAL argument failed during code
generation with CompileException: Unsupported call. I added (DOUBLE, DECIMAL)
and (DECIMAL, DOUBLE) runtime overloads, registered both pairs, and added
MathFunctionsITCase coverage for ATAN2(y, 1.0) and ATAN2(d, 1.0E0) through the
Table API and SQL. PR: https://github.com/apache/flink/pull/30263
Could a committer please assign this issue to me (linkgoal)?
Release note: Fixes a planning failure (Unsupported call) when ATAN2 is called
with one DECIMAL and one non-DECIMAL argument.
> ATAN2 fails at planning when only one argument is a DECIMAL
> -----------------------------------------------------------
>
> Key: FLINK-41787
> URL: https://issues.apache.org/jira/browse/FLINK-41787
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 2.3.0
> Reporter: Ramin Gharib
> Priority: Major
> Labels: pull-request-available
>
> ATAN2 fails with {{Unsupported call}} when one argument is a DECIMAL and the
> other is an integer or a DOUBLE. Two DECIMAL arguments work, and so do two
> arguments of other numeric types. A literal such as {{1.0}} is a DECIMAL, so
> {{ATAN2(y, 1.0)}} fails for an INT column {{y}}.
> {code:sql}
> SELECT y, ATAN2(y, 1.0) AS a FROM (VALUES (1), (2)) AS t(y);
> SELECT d, ATAN2(d, 1.0E0) AS a FROM (VALUES (1.0), (2.0)) AS t(d);
> {code}
> ||Call||Expected for 1||Actual||
> |{{ATAN2(y, 1.0)}}, {{y}} INT|0.7853981633974483|{{CodeGenException:
> Unsupported call: ATAN2(INT NOT NULL, DECIMAL(2, 1) NOT NULL)}}|
> |{{ATAN2(d, 1.0E0)}}, {{d}} DECIMAL|0.7853981633974483|{{CodeGenException:
> Unsupported call: ATAN2(DECIMAL(2, 1) NOT NULL, DOUBLE NOT NULL)}}|
> |{{ATAN2(y, 1.0E0)}}|0.7853981633974483|0.7853981633974483|
> |{{ATAN2(d, 1.0)}}|0.7853981633974483|0.7853981633974483|
> The same in batch and streaming mode, and in the Table API.
> h3. Cause
> {{FunctionGenerator}} registers ATAN2 only for (DOUBLE, DOUBLE) and (DECIMAL,
> DECIMAL) (lines 111-113), and the lookup matches a DECIMAL argument only with
> a DECIMAL parameter. POWER and LOG register the mixed pairs, such as
> {{POWER_NUM_DEC}} and {{POWER_DEC_NUM}}.
> h3. Proposal
> Register (DOUBLE, DECIMAL) and (DECIMAL, DOUBLE) for ATAN2, as for POWER.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)