impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zoltan Borok-Nagy (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-5936: operator '%' overflows on large decimals
Date Thu, 16 Nov 2017 17:45:02 GMT
Hello Taras Bobrovytsky, Tim Armstrong, 

I'd like you to reexamine a change. Please visit

to look at the new patch set (#2).

Change subject: IMPALA-5936: operator '%' overflows on large decimals

IMPALA-5936: operator '%' overflows on large decimals

Suppose we have a large decimal number, which is greater
than INT_MAX. We want to calculate the modulo of this
number by 3:

The result of this calculation can be 0, 1, or 2.
This can fit into a decimal with precision 1.

The in-memory representation of such small decimals are
stored in int32_t in the backend. Let's call this int32_t
the result type. The backend had the invalid assumption
that it can do the calculation as well using the result type.
This assumption is true for multiplying or adding numbers,
but not for modulo.

Now the backend selects the biggest type of ['return type',
'1st operand type', '2nd operand type'] to do the calculation.

Change-Id: I2b06c8acd5aa490943e84013faf2eaac7c26ceb4
M be/src/exprs/
M testdata/workloads/functional-query/queries/QueryTest/decimal-exprs.test
2 files changed, 20 insertions(+), 1 deletion(-)

  git pull ssh:// refs/changes/74/8574/2
To view, visit
To unsubscribe, visit

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2b06c8acd5aa490943e84013faf2eaac7c26ceb4
Gerrit-Change-Number: 8574
Gerrit-PatchSet: 2
Gerrit-Owner: Zoltan Borok-Nagy <>
Gerrit-Reviewer: Taras Bobrovytsky <>
Gerrit-Reviewer: Tim Armstrong <>

  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message