Zach Amsden has posted comments on this change.

Change subject: IMPALA-4936 and IMPALA-4915: Fix decimal overflow test
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/6068/2/be/src/runtime/decimal-value.inline.h
File be/src/runtime/decimal-value.inline.h:

PS2, Line 83: abs
> I'm confused: how is std::abs wrong here for integers? int64_t d is never a
std::abs is only wrong for integers outside of the decimal range, in particular 
INT_MIN, but here INT_MIN is a valid input.  To not have undefined behavior, 
this test really should be:

if (d > max_value || d < -max_value)

What I'm saying is that blanket replacement of abs with std::abs isn't going to 
solve everything, with 2's complement, both abs() and std::abs() have undefined 
(or unspecified) behavior.


-- 
To view, visit http://gerrit.cloudera.org:8080/6068
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8de7440a585c1d3d937fcbb435b9ead77e7b5a63
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Zach Amsden <zams...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dhe...@cloudera.com>
Gerrit-Reviewer: Jim Apple <jbapple-imp...@apache.org>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Michael Ho <k...@cloudera.com>
Gerrit-Reviewer: Zach Amsden <zams...@cloudera.com>
Gerrit-HasComments: Yes

Reply via email to