Description
The avg() udf, when applied to a decimal column, selects the precision/scale of the intermediate sum field as (p+4, s+4), which is the same for the precision/scale of the avg() result. However, the additional scale increase is unnecessary, and the problem of data overflow may occur. The requested change is that for the intermediate sum result, the precsion/scale is set to (p+10, s), which is consistent to sum() udf. The avg() result still keeps its precision/scale.
Attachments
Attachments
Issue Links
- duplicates
-
HIVE-6522 AVG() failure with decimal type
- Resolved
- is related to
-
HIVE-13423 Handle the overflow case for decimal datatype for sum()
- Closed
- relates to
-
HIVE-5872 Make UDAFs such as GenericUDAFSum report accurate precision/scale for decimal types
- Resolved
- links to