pub fn calculate_result_decimal_for_avg(
    sum: i128,
    count: i128,
    sum_scale: i8,
    target_type: &DataType
) -> Result<ScalarValue>
Expand description

Returns sum/count for decimal values, detecting and reporting overflow.

  • sum: stored as Decimal128 with sum_scale scale
  • count: stored as a i128 (NOT a Decimal128 value)
  • sum_scale: the scale of sum
  • target_type: the output decimal type