[
https://issues.apache.org/jira/browse/IMPALA-7255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535054#comment-16535054
]
Tim Armstrong commented on IMPALA-7255:
---------------------------------------
[~tarasbob] is this fixed with decimal_v2?
> Incorrect result rounding midpoint negative numbers to negative precision
> -------------------------------------------------------------------------
>
> Key: IMPALA-7255
> URL: https://issues.apache.org/jira/browse/IMPALA-7255
> Project: IMPALA
> Issue Type: Bug
> Reporter: Ian Cook
> Priority: Major
>
> Based on the Impala docs and on the behavior of other SQL engines, it's
> evident that:
> {{round(-15, -1)}} should return {{-20}}
> {{round(-150, -2)}} should return {{-200}}
> and so on, because negative values at the midpoint between the upper and
> lower rounded values are supposed to round to the value farther from zero.
> However, in Impala:
> {{round(-15, -1)}} returns {{-10}}
> {{round(-150, -2)}} returns {{-100}}
> and so on. This issue affects cases where both arguments are negative and the
> number being rounded is at the midpoint. I believe this issue affects cases
> where the first argument has any of the integer data types or the {{FLOAT}}
> or {{DOUBLE}} type, but not when it has a {{DECIMAL}} type. This issue seems
> to occur regardless of whether the numbers being rounded are specified as
> literals, column references, or expressions.
> To reproduce this, execute queries like:
> {{SELECT round(-15, -1);}}
> {{SELECT round(-150, -2);}}
> {{SELECT round(cast(-150 AS BIGINT), -2);}}
> {{SELECT round(cast(-150 AS DOUBLE), -2);}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]