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 2020/12/23 23:59:00 UTC

[jira] [Resolved] (IMPALA-1880) pmod() sometimes returns negative values

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

Tim Armstrong resolved IMPALA-1880.
-----------------------------------
    Resolution: Won't Fix

Looks like we've documented the behaviour, and Hive has the same behaviour, so probably not worth breaking compatibility here.

> pmod() sometimes returns negative values
> ----------------------------------------
>
>                 Key: IMPALA-1880
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1880
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 2.2
>            Reporter: John Russell
>            Priority: Trivial
>              Labels: sql-language
>
> I noticed when constructing examples to compare/contrast fmod(), pmod(), and the new mod() function that pmod() sometimes returns a negative value, despite its being stated to be the "positive" modulus:
> {code}
> [localhost:21000] > select pmod(5,-2);
> +-------------+
> | pmod(5, -2) |
> +-------------+
> | -1          |
> +-------------+
> {code}
> I see that's the same return value as Hive:
> {code}
> hive> select pmod(5,-2) from t1 limit 1;
> Total MapReduce jobs = 1
> ...
> OK
> -1
> Time taken: 29.269 seconds
> {code}
> This seems to be the origin of the Hive pmod() function, it isn't spec'ed out in detail: https://issues.apache.org/jira/browse/HIVE-656
> I thought we should verify that our behavior is working as intended, and if so let's firm up the explanation of the function a big. ("Returns the positive modulus except if second argument negative", or something like that.)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)