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

Martijn Visser commented on FLINK-39122:
----------------------------------------

The PR rejects a literal argument that overflows, at validation. The same value 
from a column, a view, CAST(123.456 AS DECIMAL(6, 3)) or 123.4 + 0.056 still 
becomes NULL, and so do CAST and INSERT into a DECIMAL(2, 2) column. PostgreSQL 
17 and DuckDB 2.0 raise an overflow error for all of these. Is erroring for 
literals only the behavior we want while FLINK-24847 is open?

> Decimals with incorrect precision lead to null value in PTF
> -----------------------------------------------------------
>
>                 Key: FLINK-39122
>                 URL: https://issues.apache.org/jira/browse/FLINK-39122
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / Planner
>            Reporter: Timo Walther
>            Priority: Major
>              Labels: pull-request-available
>
> Instead of a type error the following call leads to a null value for the 
> decimal:
> {code}
>         // execute a Flink SQL job and print the result locally
>         tableEnv.fromCall(RulePtf.class, new 
> BigDecimal("123.456")).execute().print();
>     }
>     /** A PTF that filters data based on a dynamic allowlist. */
>     public static class RulePtf extends ProcessTableFunction<String> {
>         public void eval(@DataTypeHint("DECIMAL(2, 2)") BigDecimal decimal) 
> throws Exception {
>             System.out.println(decimal);
>         }
>     }
> {code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to