Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
Impala 2.2
-
None
Description
In constructing examples for the mod() function, I noticed that with some combinations of arguments the DECIMAL overload was not chosen, leading to rounding errors:
select mod(9.9,3); +--------------------+ | mod(9.9, 3) | +--------------------+ | 0.8999996185302734 | +--------------------+
If I use a cast or a more obviously DECIMAL literal for the second argument, I get the expected result:
select mod(9.9, cast(3 as decimal(2,1))); +-----------------------------------+ | mod(9.9, cast(3 as decimal(2,1))) | +-----------------------------------+ | 0.9 | +-----------------------------------+ select mod(9.9,3.0); +---------------+ | mod(9.9, 3.0) | +---------------+ | 0.9 | +---------------+
Attachments
Issue Links
- duplicates
-
IMPALA-2233 Impala should not choose a function signature that results in loss of precision
-
- Resolved
-
-
IMPALA-3437 Consider changing arithmetic conversions to produce decimal in more cases
-
- Resolved
-
- relates to
-
IMPALA-5936 Difference between the % Operator and Mod function with large decimal values
-
- Closed
-