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

[jira] [Created] (IMPALA-7805) NumericLiteral toSql() should render zero as 0, not 0-E38, 0.000, etc.

Paul Rogers created IMPALA-7805:
-----------------------------------

             Summary: NumericLiteral toSql() should render zero as 0, not 0-E38, 0.000, etc.
                 Key: IMPALA-7805
                 URL: https://issues.apache.org/jira/browse/IMPALA-7805
             Project: IMPALA
          Issue Type: Improvement
          Components: Frontend
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers


Testing of other issues revealed a somewhat bizarre aspect of how the planner expression nodes render 0. {{NumericLiteral.toSql()}} uses the Java {{BigDecimal}} class to convert a numeric value to a string for use in explained plans.

The default Java behavior is to consider scale when rendering numbers, including 0. Thus, depending on precision and scale, you may get:

{noformat}
0
0.0
0.00
0.000
...
0E-38
{noformat}

Mathematically, zero is zero. Unlike Java, SQL attaches no significance to the decimal point. (In Java, 0 is an integer, 0.0 is a float.) Nor does SQL attach significance to the number of zeros past the decimal point.

To make testing easier, change the behavior to always emit "0" when the value is zero, regardless of precision or scale.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)