impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Apple (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-2020: Make it easy to work with big numbers
Date Mon, 06 Feb 2017 21:20:48 GMT
Jim Apple has posted comments on this change.

Change subject: IMPALA-2020: Make it easy to work with big numbers

Patch Set 2:

Commit Message:

PS2, Line 7: Make it easy to work with big numbers
More specifically: allow writing 128-bit literals

PS2, Line 10: legal C++
This is a gcc/clang issue, not a C++ one

Line 16: __int128 bignines = LargeNum<__int128>(9, 38);`
What happens if you pass parameters that make it overflow?
File be/src/util/decimal-util.h:

Line 44:   template<typename T>
If this is only supposed to be called at compile-time, all the parameters can be template

Line 45:   static constexpr T LargeNum(int digit, int precision, int base = 10) {
This is the kind of API that I would foul up by swapping the params. Is there anything that
be done to make this more fool-proof? Some ideas:

1. digit should be less than base.
2. digit should never be 0 or negative.
3. The top-level recursive call should always produce a number that doesn't fit in 64 bits
and does fit in 128 bits
4. Can it be called on a const char *, perhaps, reducing digit and precision to one parameter?

PS2, Line 46: (
> nit: extraneous parens
Handle non-positive precision.

To view, visit
To unsubscribe, visit

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

View raw message