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-4813: Round on divide and multiply
Date Wed, 01 Mar 2017 06:42:56 GMT
Dan Hecht has posted comments on this change.

Change subject: IMPALA-4813: Round on divide and multiply

Patch Set 8:

File be/src/exprs/

Line 1339:   { "1.23 * cast(1 as decimal(20,3))", {{ false, 123000, 23, 5 }}},
> Without the result type change, I have been unable to find a meaningful way
okay, that makes sense.
File be/src/runtime/decimal-value.inline.h:

PS8, Line 311: sp
> single precision (not entirely accurate, but...)
i don't think the name will be obvious, but i also don't really have another suggestion other
than x16 or x128, and neither is great, so okay to leave it alone.

Line 346:         DCHECK(r != 0);
> It's actually impossible to get a zero value here (value == non-zero value)
But we may have promoted to a higher type in this case. The inputs might be 4-byte (i.e. 9
or less precision), while the result is 8-bytes (18 or less precision). So, the premise that
we didn't need to promote is false.  Or am I misunderstanding?

Line 350:     DCHECK(sizeof(RESULT_T) > 8 || abs(r) <= DecimalUtil::MAX_UNSCALED_DECIMAL8);
> Either we have to promote to a RESULT_T that can hold the result, or there 
but we may have promoted from 4 to 8. i think what you're trying to show is that RESULT_T
is chosen correctly (which also means that the static_cast on the next line is a no-op). so,
should it be:

 (sizeof(RESULT_T) > 8 || abs(r) <= MAX_UNSCALED_DECIMAL8) &&
 (sizeof(RESULT_T) > 4 || abs(r) <= MAX_UNSCALED_DECIMAL4));

File be/src/util/bit-util.h:

Line 52:                               std::is_same<CVR_REMOVED, __int128>{}, int>::type
= 0>
> Sure, but then all the following template conditions will become grotesque:
okay, let's leave it alone.

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie6bfcbe37555b74598d409c6f84f06b0ae5c4312
Gerrit-PatchSet: 8
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