Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8309 )
Change subject: IMPALA-5019: Decimal V2 addition ...................................................................... Patch Set 3: (5 comments) I'm gradually understanding this better. Had some further suggestions to make it easier to follow but I think I'm getting close. http://gerrit.cloudera.org:8080/#/c/8309/3/be/src/runtime/decimal-value.inline.h File be/src/runtime/decimal-value.inline.h: http://gerrit.cloudera.org:8080/#/c/8309/3/be/src/runtime/decimal-value.inline.h@179 PS3, Line 179: int128_t& x_left, int128_t& x_right, int128_t& y_left, int128_t& y_right) { Use pointers for output arguments: https://google.github.io/styleguide/cppguide.html#Reference_Arguments http://gerrit.cloudera.org:8080/#/c/8309/3/be/src/runtime/decimal-value.inline.h@214 PS3, Line 214: right_overflow carry_to_left might be a better name? Since the intent is to carry this into the left. http://gerrit.cloudera.org:8080/#/c/8309/3/be/src/runtime/decimal-value.inline.h@243 PS3, Line 243: inline int128_t SubtractLarge(int128_t x, int x_scale, int128_t y, int y_scale, What do you think about make it so that this always computes x - y, and making the caller responsible for switching the arguments? I think it would be easier to follow because there's one less case to handle. http://gerrit.cloudera.org:8080/#/c/8309/2/be/src/runtime/decimal-value.inline.h File be/src/runtime/decimal-value.inline.h: http://gerrit.cloudera.org:8080/#/c/8309/2/be/src/runtime/decimal-value.inline.h@305 PS2, Line 305: RESULT_T y = 0; > Delta scale is different in AdjustToSameScale(). There are two delta scales Ah ok. I wonder if renaming the variable would make it clearer. Something like result_scale_delta to make it clearer that it's between the result scale and something else? Or result_scale_decrease to indicate that we need to scale down the result by this amount. http://gerrit.cloudera.org:8080/#/c/8309/2/be/src/runtime/decimal-value.inline.h@310 PS2, Line 310: } > Added comment. Thanks. I still think something is missing in the AdjustToSameScale() name or comment, since I couldn't tell that it was intended to adjust them to the max scale without reading the code. Maybe it just needs a comment explaining how the output scale is computed. -- To view, visit http://gerrit.cloudera.org:8080/8309 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I401049c56d910eb1546a178c909c923b01239336 Gerrit-Change-Number: 8309 Gerrit-PatchSet: 3 Gerrit-Owner: Taras Bobrovytsky <[email protected]> Gerrit-Reviewer: Michael Ho <[email protected]> Gerrit-Reviewer: Taras Bobrovytsky <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]> Gerrit-Reviewer: Zach Amsden <[email protected]> Gerrit-Comment-Date: Mon, 30 Oct 2017 21:12:06 +0000 Gerrit-HasComments: Yes
