You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Tim Armstrong (JIRA)" <ji...@apache.org> on 2017/11/16 01:21:00 UTC

[jira] [Resolved] (IMPALA-1879) mod() function doesn't always interpret fractional arguments as DECIMAL

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

Tim Armstrong resolved IMPALA-1879.
-----------------------------------
    Resolution: Duplicate

> mod() function doesn't always interpret fractional arguments as DECIMAL
> -----------------------------------------------------------------------
>
>                 Key: IMPALA-1879
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1879
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 2.2
>            Reporter: John Russell
>            Priority: Minor
>              Labels: sql-language
>
> In constructing examples for the mod() function, I noticed that with some combinations of arguments the DECIMAL overload was not chosen, leading to rounding errors:
> {code}
> select mod(9.9,3);
> +--------------------+
> | mod(9.9, 3)        |
> +--------------------+
> | 0.8999996185302734 |
> +--------------------+
> {code}
> If I use a cast or a more obviously DECIMAL literal for the second argument, I get the expected result:
> {code}
> select mod(9.9, cast(3 as decimal(2,1)));
> +-----------------------------------+
> | mod(9.9, cast(3 as decimal(2,1))) |
> +-----------------------------------+
> | 0.9                               |
> +-----------------------------------+
> select mod(9.9,3.0);
> +---------------+
> | mod(9.9, 3.0) |
> +---------------+
> | 0.9           |
> +---------------+
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)