GitHub user heary-cao opened a pull request:

    https://github.com/apache/spark/pull/18057

    [SPARK-20786][SQL][Backport-2.2]Improve ceil and floor handle the value 
which is not expected

    ## What changes were proposed in this pull request?
    
    This PR is to backport #18016 to Spark branch-2.2
    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?
    the unit test.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/heary-cao/spark floor_ceil_branch_2.2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18057.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 #18057
    
----
commit 5cdb501e476ef9a46c5a7943a55dfee227c5fb6c
Author: caoxuewen <cao.xue...@zte.com.cn>
Date:   2017-05-22T06:46:21Z

    Improve ceil and floor 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to