Impala Public Jenkins has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/9114 )

Change subject: IMPALA-6429: Fix decimal division
......................................................................

IMPALA-6429: Fix decimal division

Before this patch, it was possible for an overflow to not be detected
when doing a decimal division. When scaling up the dividend before
doing the division, we do not check for overflow. This is ok if the
we are scaling up by 10^38 or less because the result is guaranteed to
fit into 256 bits. However, when we are scaling up by more than 38, the
result may not fit into 256 bits and overflow. This overflow may not be
detected.

The problem is fixed by checking for overflow when scaling up the
dividend. The overflow check is done efficiently, by counting the
leading zeros. I added a test to prove that this check is correct.

Testing:
- Added some BE tests
- I ran a few benchmarks and did not see any performance regressions

Change-Id: Ibd1075d9c78986cd975dd29c1125d71ba6560c23
Reviewed-on: http://gerrit.cloudera.org:8080/9114
Reviewed-by: Taras Bobrovytsky <[email protected]>
Tested-by: Impala Public Jenkins
---
M be/src/exprs/expr-test.cc
M be/src/runtime/decimal-value.inline.h
M be/src/util/decimal-util.h
3 files changed, 127 insertions(+), 40 deletions(-)

Approvals:
  Taras Bobrovytsky: Looks good to me, approved
  Impala Public Jenkins: Verified

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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd1075d9c78986cd975dd29c1125d71ba6560c23
Gerrit-Change-Number: 9114
Gerrit-PatchSet: 6
Gerrit-Owner: Taras Bobrovytsky <[email protected]>
Gerrit-Reviewer: Dan Hecht <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Taras Bobrovytsky <[email protected]>
Gerrit-Reviewer: Tim Armstrong <[email protected]>
Gerrit-Reviewer: Zach Amsden <[email protected]>

Reply via email to