Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.14.0
-
This changes the result of a decimal SUM() between 1.14.0 and 1.14.1. It restores the behavior of 1.13 to be consistent with Hive/Spark.
Description
code:
tableEnv.executeSql("select sum(cast( 1.03520274 as decimal(32, 8))) as num ").print();
expected:
1.03520274
actual:
1.03520270
This function is normal in version 1.13.x.
I found the code that caused the inconsistency:
org.apache.flink.table.types.logical.utils.LogicalTypeMerging#adjustPrecisionScale method was added in 1.14. Because sum() generates max precision(38) by default, it leads to special circumstances, which reduces the scale by 1.
Attachments
Attachments
Issue Links
- is related to
-
FLINK-24809 Check & possible fix decimal precision and scale for all Aggregate functions
-
- Closed
-
- links to