GitHub user davies opened a pull request:
https://github.com/apache/spark/pull/11894
[SPARK-13806] [SQL] fix rounding mode of negative float/double
## What changes were proposed in this pull request?
Round() in database usually round the number up (away from zero), it's
different than Math.round() in Java.
For example:
```
scala> java.lang.Math.round(-3.5)
res3: Long = -3
```
In Database, we should return -4.0 in this cases.
This PR remove the buggy special case for scale=0.
## How was this patch tested?
Add tests for negative values with tie.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/davies/spark fix_round
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/11894.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #11894
----
commit 74f4a397505627e8cf183b196e742d6857967e97
Author: Davies Liu <[email protected]>
Date: 2016-03-22T18:00:05Z
fix rounding mode of negative float/double
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]