Dan Hecht has posted comments on this change. Change subject: IMPALA-4813: Round on divide and multiply ......................................................................
Patch Set 8: (2 comments) http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/runtime/decimal-test.cc File be/src/runtime/decimal-test.cc: Line 635: result_scale); > Are you sure you didn't miss the max(6, t1.scale + t2.precision + 1) above? When the desired result precision is > 38, the java code reduces both precision and scale (see createAdjustedDecimalType()). This code only reduces precision. A simple example that would show the difference is: DECIMAL(38,38) / DECIMAL(38,38). The java code will give DECIMAL(38,6). This code will give: result_scale = min(38, max(6, 38 + 38 + 1)) = 38 result_prec = min(38, 38 - 38 + 38 + 38) = 38 i.e. DECIMAL(38, 38). http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/runtime/decimal-value.inline.h File be/src/runtime/decimal-value.inline.h: Line 350: DCHECK(sizeof(RESULT_T) > 8 || abs(r) <= DecimalUtil::MAX_UNSCALED_DECIMAL8); > That is what I was trying to say. How about using the DCHECK I wrote out then, to be clear about this? -- To view, visit http://gerrit.cloudera.org:8080/6132 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie6bfcbe37555b74598d409c6f84f06b0ae5c4312 Gerrit-PatchSet: 8 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Zach Amsden <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Michael Ho Gerrit-Reviewer: Michael Ho <[email protected]> Gerrit-Reviewer: Zach Amsden <[email protected]> Gerrit-HasComments: Yes
