You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Sudheesh Katkam (JIRA)" <ji...@apache.org> on 2014/06/12 02:41:02 UTC

[jira] [Commented] (DRILL-961) 0.0 divided by a very small number should be zero

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

Sudheesh Katkam commented on DRILL-961:
---------------------------------------

I can not replicate this issue. Here's what I get:

In postgres,
=# select (cast(0.0 as float)/cast(-0.000000010 as decimal));
 ?column? 
----------
       -0
(1 row)


In drill,
0: jdbc:drill:zk=local> select (cast(0.0 as float)/cast(-0.000000010 as decimal(18,9))) from cp.`employee.json` limit 1;
+------------+
|   EXPR$0   |
+------------+
| -0.0       |
+------------+
1 row selected (0.117 seconds)

> 0.0 divided by a very small number should be zero
> -------------------------------------------------
>
>                 Key: DRILL-961
>                 URL: https://issues.apache.org/jira/browse/DRILL-961
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Chun Chang
>            Assignee: Mehant Baid
>
> #Wed Jun 11 10:19:21 PDT 2014
> git.commit.id.abbrev=27a9c98
> In handling non-precise division, the following should be handled well:
> double / decimal18(18,9)
> 0 / -0.000000010
> This yields as -0 in postgres:
> foodmart=# select c_row, c_float8, cast(c_decimal18 as decimal(18,9)),  c_float8 / cast(c_decimal18 as decimal(18,9)) from data where c_row = 7;
>  c_row | c_float8 | c_decimal18  | ?column?
> -------+----------+--------------+----------
>      7 |        0 | -0.000000010 |       -0
> Drill yields NaN:
> 0: jdbc:drill:schema=dfs> select c_row, c_float8, cast(c_decimal18 as decimal(18,9)),  c_float8 / cast(c_decimal18 as decimal(18,9)) from data where c_row = 7;
> +------------+------------+------------+------------+
> |   c_row    |  c_float8  |   EXPR$2   |   EXPR$3   |
> +------------+------------+------------+------------+
> | 7          | 0.0        | -1.0E-8    | NaN        |
> +------------+------------+------------+------------+



--
This message was sent by Atlassian JIRA
(v6.2#6252)