drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mehant Baid (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DRILL-524) Drill returns float for MOD function that contains decimal number & divident not returned if divider is 0
Date Wed, 02 Jul 2014 02:25:24 GMT

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

Mehant Baid updated DRILL-524:
------------------------------

    Assignee: Yash Sharma  (was: Mehant Baid)

> Drill returns float for MOD function that contains decimal number & divident not
returned if divider is 0 
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-524
>                 URL: https://issues.apache.org/jira/browse/DRILL-524
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>    Affects Versions: 1.0.0
>            Reporter: Krystal
>            Assignee: Yash Sharma
>             Fix For: 1.0.0-BETA1
>
>         Attachments: Drill-524.patch
>
>
> Ran the following mod function in drill:
> 0: jdbc:drill:schema=dfs> select mod(12.4,5) from dfs.`voter` where rownum=10;
> +------------+
> |   EXPR$0   |
> +------------+
> | 2.4000000000000004 |
> +------------+
> The result is a float which looks messy.  The other db platforms return result based
on the highest number of significant digits either from the divident or divider.  For example
from oracle:
> SQL> select mod(12.4,5) from voter where voter_id=10;
> MOD(12.4,5)
> -----------
> 	2.4
> SQL> select mod(12.45,5.1) from voter where voter_id=10;
> MOD(12.45,5.1)
> --------------
> 	  2.25
> Another issue is when the divider is 0.  Here is the spec for MOD from http://users.atw.hu/sqlnut/sqlnut2-chp-4-sect-4.html
> ...returns the dividend if the divider is 0
> Drill returns "NaN" if the divider is 0:
> 0: jdbc:drill:schema=dfs> select mod(age,0) from dfs.`voter` where rownum=11;
> +------------+
> |   EXPR$0   |
> +------------+
> | NaN        |
> +------------+
> Based on postgres, mysql and oracle databases, only oracle adheres to this rule:
> SQL> select mod(12.45,0) from voter where voter_id=10;
> MOD(12.45,0)
> ------------
>        12.45



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

Mime
View raw message