impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Hecht (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-2020: Add rounding for decimal casts
Date Thu, 16 Feb 2017 17:57:19 GMT
Dan Hecht has posted comments on this change.

Change subject: IMPALA-2020: Add rounding for decimal casts

Patch Set 11:


> I have not updated the Python test yet, as that would require a
 > rebase.  Python test and benchmark will come in next patch set,
 > this is just to give a clean slate for review.

Thanks.  Just some minor comments on the code. 

I think the benchmark is higher priority than the python test since we already have pretty
good functional test coverage and so less likely to be surprised, whereas there could be a
perf regression.

We could even do the python test as a follow on commit if that is a fair amount of work (perhaps
even after taking care of divide rounding).
File be/src/exprs/

PS11, Line 1526: power(10, 3) - power(10, -1)
at some point in the future, we may implement a decimal variant of POWER(), in which case
these test cases would no longer exercise the CAST(double as decimal) path.  So, how about
either adding a check:

// The CAST FLOAT -> DECIMAL test cases rely on power() returning
// a double. If that changes, those test cases need to be updated.
TestStringValue("typeOf(power(10,1))", "DOUBLE");

Or, we could add the explicit cast to double/float now.

Line 1601:     {{ false, -999, 3, 0 }}},
there all do DOUBLE -> DECIMAL.  How about adding some FLOAT -> DECIMAL cases as well?
File be/src/runtime/decimal-value.h:

PS11, Line 232: Optionally
delete "Optionally" since it's not optional.

PS11, Line 233: otherwise the result is truncated.
delete since this doesn't do truncation
File be/src/runtime/decimal-value.inline.h:

PS11, Line 45: mantissaa

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: I2daf186b4770a022f9cb349d512067a1dd624810
Gerrit-PatchSet: 11
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Zach Amsden <>
Gerrit-Reviewer: Dan Hecht <>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Michael Ho <>
Gerrit-Reviewer: Zach Amsden <>
Gerrit-HasComments: Yes

View raw message