-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20876][SQL]If the input parameter is float type for ceil or floor,the result is not we expected #18103
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
953d207 to
c9331e3
Compare
|
ok to test |
1 similar comment
|
ok to test |
|
Test build #77345 has finished for PR 18103 at commit
|
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.
You also need to fix this code path.
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.
Moving the related test cases from operators.sql here. You can hit the bug I mentioned above.
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.
yes, actually, i have done it as #18082
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.
@gatorsmile I closed the PR #18082 temporarily
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.
No need to add FloatType, I think. Type coersion will promote it to 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.
yes, it will promote it to DoubleType, but must move LongType to end
|
Test build #77444 has finished for PR 18103 at commit
|
|
Could you remove the sql statements from opterators.sql after you moving them to mathExpressionSuite? |
|
LGTM except one comment. |
|
Test build #77450 has started for PR 18103 at commit |
… is not we expected
|
Test build #77458 has finished for PR 18103 at commit
|
|
Thanks! Merging to master. |
|
Could you open another PR to backport the fix to 2.2? Thanks! |
What changes were proposed in this pull request?
spark-sql>SELECT ceil(cast(12345.1233 as float));
spark-sql>12345
For this case, the result we expected is
12346spark-sql>SELECT floor(cast(-12345.1233 as float));
spark-sql>-12345
For this case, the result we expected is
-12346Because in
CeilorFloor,inputTypeshas no FloatType, so it is converted to LongType.How was this patch tested?
After the modification:
spark-sql>SELECT ceil(cast(12345.1233 as float));
spark-sql>12346
spark-sql>SELECT floor(cast(-12345.1233 as float));
spark-sql>-12346