[jira] [Created] (FLINK-22586) Improve precision derivation for decimal arithmetics

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-22586) Improve precision derivation for decimal arithmetics

Shang Yuanchun (Jira)
Shuo Cheng created FLINK-22586:
----------------------------------

             Summary: Improve precision derivation for decimal arithmetics
                 Key: FLINK-22586
                 URL: https://issues.apache.org/jira/browse/FLINK-22586
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / Runtime
    Affects Versions: 1.13.0
            Reporter: Shuo Cheng
             Fix For: 1.14.0


Currently the precision and scale derivation is not properly for decimal data arithmetics, e.g,

considering the following example:
{code:java}
select cast('10.1' as decimal(38, 19)) * cast('10.2' as decimal(38, 19)) from T{code}
the result is `null`, which may confuses use a lot, because the result is far from overflow actually. 

The root cause is the precision derivation for the above multiplication is:

(38, 19) * (38, 19) -> (38, 38)

So there is no space for integral digits, which leads to null results.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)