wenhuitang commented on pull request #1867: URL: https://github.com/apache/calcite/pull/1867#issuecomment-626162293
> I investigated the return type for sum function in Hive[1] and Spark[2]. It seems they both compute the precision as `Math.min(MAX_PRECISION, inputPrecision + 10)`. Maybe we can align with them. > @wenhuitang @XuQianJin-Stars @hsyuan WDYT? > > [1]https://github.com/apache/hive/blob/54b87999fa0c23f9902faae609e7441e0693a22b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java#L247 > > [2]https://github.com/apache/spark/blob/272d229005b7166ab83bbb8f44a4d5e9d89424a1/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala#L56 Thanks a lot. I have rebased this pr. IMO, as for computing precision as Math.min(MAX_PRECISION, inputPrecision + 10), I did not find any theory or standard for it. To avoid the problem completely, it would be ok with max precision. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
