Paul Rogers created IMPALA-7888:
-----------------------------------
Summary: Incorrect NumericLiteral overflow checks for FLOAT, DOUBLE
Key: IMPALA-7888
URL: https://issues.apache.org/jira/browse/IMPALA-7888
Project: IMPALA
Issue Type: Bug
Components: Frontend
Affects Versions: Impala 3.0
Reporter: Paul Rogers
Assignee: Paul Rogers
Consider the following (new) unit test:
{code:java}
assertFalse(NumericLiteral.isOverflow(BigDecimal.ZERO, Type.FLOAT));
{code}
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:
{code:java}
case FLOAT:
return (value.compareTo(BigDecimal.valueOf(Float.MAX_VALUE)) > 0 ||
value.compareTo(BigDecimal.valueOf(Float.MIN_VALUE)) < 0);
{code}
For Float, {{MIN_VALUE}} is the smallest positive number that Float can
represent:
{code:java}
public static final float MIN_VALUE = 0x0.000002P-126f; // 1.4e-45f
{code}
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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]