Skip to content

Conversation

@heary-cao
Copy link
Contributor

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.

@hvanhovell
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented May 22, 2017

Test build #77178 has finished for PR 18057 at commit 5cdb501.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@heary-cao heary-cao force-pushed the floor_ceil_branch_2.2 branch from 5cdb501 to 1ecd0e2 Compare May 22, 2017 11:59
@SparkQA
Copy link

SparkQA commented May 22, 2017

Test build #77184 has finished for PR 18057 at commit 1ecd0e2.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@heary-cao heary-cao force-pushed the floor_ceil_branch_2.2 branch from 1ecd0e2 to eaf236a Compare May 25, 2017 02:28
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default type should be DoubleType

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default type should be DoubleType

@SparkQA
Copy link

SparkQA commented May 25, 2017

Test build #77327 has finished for PR 18057 at commit eaf236a.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@heary-cao heary-cao force-pushed the floor_ceil_branch_2.2 branch from eaf236a to 4c68688 Compare May 25, 2017 04:13
@SparkQA
Copy link

SparkQA commented May 25, 2017

Test build #77333 has finished for PR 18057 at commit 4c68688.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.


override def inputTypes: Seq[AbstractDataType] =
Seq(TypeCollection(DoubleType, DecimalType))
Seq(TypeCollection(DoubleType, LongType, DecimalType))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should modify the change from what we did at master when backporting as far as possible .
If you want to modify this, let's submit another pr to master first, and then backport it too.

@heary-cao
Copy link
Contributor Author

the patch by #18103 merge together.
close pr.
thanks.
@10110346
@hvanhovell

@heary-cao heary-cao closed this May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants