Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Impala 3.0
-
None
-
None
-
ghx-label-1
Description
Consider the following (new) unit test:
assertFalse(NumericLiteral.isOverflow(BigDecimal.ZERO, Type.FLOAT));
This test fails (that is, the value zero, so the method claims, overflows a FLOAT.)
The reason is a misunderstanding of the meaning of MIN_VALUE for Float:
case FLOAT: return (value.compareTo(BigDecimal.valueOf(Float.MAX_VALUE)) > 0 || value.compareTo(BigDecimal.valueOf(Float.MIN_VALUE)) < 0);
For Float, MIN_VALUE is the smallest positive number that Float can represent:
public static final float MIN_VALUE = 0x0.000002P-126f; // 1.4e-45f
The value that the Impala code wants to check it - Float.MAX_VALUE.
The only reason that this is not marked as more serious is that the method appears to be used in only one place, and that place does not use FLOAT values.
Attachments
Issue Links
- Is contained by
-
IMPALA-7902 Revise NumericLiteral to avoid analysis, fix multiple issues
- Resolved