Dan Hecht has posted comments on this change.

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


Patch Set 8:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/exprs/expr-test.cc
File be/src/exprs/expr-test.cc:

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.


http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/runtime/decimal-value.inline.h
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:

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

?


http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/util/bit-util.h
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 http://gerrit.cloudera.org:8080/6132
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie6bfcbe37555b74598d409c6f84f06b0ae5c4312
Gerrit-PatchSet: 8
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Zach Amsden <[email protected]>
Gerrit-Reviewer: Dan Hecht <[email protected]>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Michael Ho <[email protected]>
Gerrit-Reviewer: Zach Amsden <[email protected]>
Gerrit-HasComments: Yes

Reply via email to