Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-20786

Improve ceil and floor handle the value which is not expected

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Component/s: SQL
    • Labels:
      None

      Description

      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)

        Attachments

          Activity

            People

            • Assignee:
              heary-cao caoxuewen
              Reporter:
              heary-cao caoxuewen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: