You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Jacques Nadeau (JIRA)" <ji...@apache.org> on 2014/07/21 05:17:38 UTC
[jira] [Resolved] (DRILL-524) Drill returns float for MOD function
that contains decimal number & divident not returned if divider is 0
[ https://issues.apache.org/jira/browse/DRILL-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacques Nadeau resolved DRILL-524.
----------------------------------
Resolution: Fixed
> 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: DrillCommitter
> Fix For: 1.0.0-BETA1
>
>
> 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)