-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20786][SQL][Backport-2.2]Improve ceil and floor handle the value which is not expected #18057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
ok to test |
|
Test build #77178 has finished for PR 18057 at commit
|
5cdb501 to
1ecd0e2
Compare
|
Test build #77184 has finished for PR 18057 at commit
|
1ecd0e2 to
eaf236a
Compare
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
|
Test build #77327 has finished for PR 18057 at commit
|
eaf236a to
4c68688
Compare
|
Test build #77333 has finished for PR 18057 at commit
|
|
|
||
| override def inputTypes: Seq[AbstractDataType] = | ||
| Seq(TypeCollection(DoubleType, DecimalType)) | ||
| Seq(TypeCollection(DoubleType, LongType, DecimalType)) |
There was a problem hiding this comment.
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.
|
the patch by #18103 merge together. |
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.