GitHub user heary-cao opened a pull request:
https://github.com/apache/spark/pull/18016
Improve ceil handle the value which is not expected
## What changes were proposed in this pull request?
spark-sql>SELECT ceil(1234567890123456);
1234567890123456
spark-sql>SELECT ceil(12345678901234567);
12345678901234568
spark-sql>SELECT ceil(123456789012345678);
123456789012345680
when the length of the getText is greater than 16. long to double will be
precision loss.
but mysql handle the value is ok.
mysql> SELECT ceil(1234567890123456);
+------------------------+
| ceil(1234567890123456) |
+------------------------+
| 1234567890123456 |
+------------------------+
1 row in set (0.00 sec)
mysql> SELECT ceil(12345678901234567);
+-------------------------+
| ceil(12345678901234567) |
+-------------------------+
| 12345678901234567 |
+-------------------------+
1 row in set (0.00 sec)
mysql> SELECT ceil(123456789012345678);
+--------------------------+
| ceil(123456789012345678) |
+--------------------------+
| 123456789012345678 |
+--------------------------+
1 row in set (0.00 sec)
## How was this patch tested?
Supplement the unit test.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/heary-cao/spark ceil_long
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18016.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 #18016
----
commit 226d2996098f5976aa29426cd6db3997abaa3aac
Author: caoxuewen <[email protected]>
Date: 2017-05-17T10:29:38Z
Improve ceil handle the value which is not expected
----
---
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]