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 "Tim Armstrong (JIRA)" <ji...@apache.org> on 2018/11/05 19:28:00 UTC

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

    [ https://issues.apache.org/jira/browse/IMPALA-7805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16675650#comment-16675650 ] 

Tim Armstrong commented on IMPALA-7805:
---------------------------------------

This would be a step towards sanity. IMPALA-5821 helps by representing type information about numeric literals in a consistent way.

> 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
>            Priority: Minor
>
> 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)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org