You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/12/29 00:02:00 UTC

[jira] [Resolved] (IMPALA-7888) Incorrect NumericLiteral overflow checks for FLOAT, DOUBLE

     [ https://issues.apache.org/jira/browse/IMPALA-7888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Rogers resolved IMPALA-7888.
---------------------------------
    Resolution: Fixed

> 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
>            Priority: Minor
>
> 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: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org