[
https://issues.apache.org/jira/browse/IMPALA-6202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631019#comment-16631019
]
ASF subversion and git services commented on IMPALA-6202:
---------------------------------------------------------
Commit ba27b038148f0694662c14710f18ee6e94cf82b7 in impala's branch
refs/heads/master from [~yzhangal]
[ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=ba27b03 ]
IMPALA-6202. mod and % should be equivalent.
Currently in DECIMAL V2 mode, typeof(9.9 % 3) is DECIMAL(2,1) and
typeof(mod(9.9, 3)) is
DECIMAL(4,1), while both are expected to be DECIMAL(2,1). This jira fixes V2
mode by
replacing "mod" with "%" at parser stage thus they share the same code path
afterwards.
Testing:
Added unit tests and done real cluster testing.
Change-Id: Ib0067da04083859ffbf662a29007154461bea2ba
Reviewed-on: http://gerrit.cloudera.org:8080/11443
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Tim Armstrong <[email protected]>
> mod and % should be equivalent
> ------------------------------
>
> Key: IMPALA-6202
> URL: https://issues.apache.org/jira/browse/IMPALA-6202
> Project: IMPALA
> Issue Type: Bug
> Affects Versions: Impala 2.11.0
> Reporter: Jim Apple
> Assignee: Yongjun Zhang
> Priority: Major
>
> The docs say:
> "mod(numeric_type a, same_type b) Purpose: Returns the modulus of a number.
> Equivalent to the % arithmetic operator."
> and
> "fmod(double a, double b), fmod(float a, float b) Purpose: Returns the
> modulus of a floating-point number. Equivalent to the % arithmetic operator."
> But these can't both be true:
> {noformat}
> [localhost:21000] > select typeof(9.9 % 3), typeof(mod(9.9, 3)),
> typeof(fmod(9.9, 3));
> +-----------------+---------------------+----------------------+
> | typeof(9.9 % 3) | typeof(mod(9.9, 3)) | typeof(fmod(9.9, 3)) |
> +-----------------+---------------------+----------------------+
> | DECIMAL(2,1) | DECIMAL(4,1) | FLOAT |
> +-----------------+---------------------+----------------------+
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]