Michael Ho has posted comments on this change. Change subject: IMPALA-4821: Update AVG() for DECIMAL_V2 ......................................................................
Patch Set 2: (4 comments) http://gerrit.cloudera.org:8080/#/c/6038/2/be/src/exprs/aggregate-functions-ir.cc File be/src/exprs/aggregate-functions-ir.cc: Line 447: // The scale of the accumulated sum is set to the scale of the output type. > I think this comment would be better in the frontend code since that's wher Done http://gerrit.cloudera.org:8080/#/c/6038/2/fe/src/main/java/org/apache/impala/analysis/FunctionCallExpr.java File fe/src/main/java/org/apache/impala/analysis/FunctionCallExpr.java: Line 336: // AVG() always get at least MIN_ADJUSTED_SCALE decimal places since it performs > gets Done Line 338: int resultScale = Math.max(ScalarType.MIN_ADJUSTED_SCALE, digitsAfter); > Is the resulting type the same as if we did (SUM(col) / COUNT(col))? In any Done http://gerrit.cloudera.org:8080/#/c/6038/2/testdata/workloads/functional-query/queries/QueryTest/decimal-exprs.test File testdata/workloads/functional-query/queries/QueryTest/decimal-exprs.test: PS2, Line 197: 0 > do these results make sense? seems surprising that this decimal place is al Yes, I tried verifying with sum()/num_rows(). That's why I used tpch_parquet.lineitem to help verify the result. -- To view, visit http://gerrit.cloudera.org:8080/6038 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I28f5ef0370938440eb5b1c6d29b2f24e6f88499f Gerrit-PatchSet: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Michael Ho <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Michael Ho <[email protected]> Gerrit-HasComments: Yes
