-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-4593] [SQL] return null when divider is 0 of Double type #3443
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
|
Test build #23821 has started for PR 3443 at commit
|
|
Test build #23821 has finished for PR 3443 at commit
|
|
Test PASSed. |
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 think expression specific behavior should not be in f2 method, which is a general purpose method for binary expression of fractional type.
|
|
|
What do you think about |
|
@ueshin Thanks for your reminding, I made a mistake here. |
|
Test build #23865 has started for PR 3443 at commit
|
|
Test build #23865 has finished for PR 3443 at commit
|
|
Test FAILed. |
|
Test build #23867 has started for PR 3443 at commit
|
|
Test build #23867 has finished for PR 3443 at commit
|
|
Test PASSed. |
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'm wondering we should check equality between the evaluated right value and zero here because evaluation right.eval(input) happens twice, here and in f2 or i2.
Should be at around _.div(_, _) or _.quot(_, _)?
|
Test build #23920 has started for PR 3443 at commit
|
|
Test build #23920 has finished for PR 3443 at commit
|
|
Test PASSed. |
|
Test build #23922 has started for PR 3443 at commit
|
|
Test build #23922 has finished for PR 3443 at commit
|
|
Test PASSed. |
|
Can you add some test cases to the |
|
Test build #24018 has started for PR 3443 at commit
|
|
Test build #24018 has finished for PR 3443 at commit
|
|
Test FAILed. |
|
Test build #24030 has started for PR 3443 at commit
|
|
Test build #24030 has finished for PR 3443 at commit
|
|
Test PASSed. |
SELECT max(1/0) FROM src would return a very large number, which is obviously not right. For hive-0.12, hive would return `Infinity` for 1/0, while for hive-0.13.1, it is `NULL` for 1/0. I think it is better to keep our behavior with newer Hive version. This PR ensures that when the divider is 0, the result of expression should be NULL, same with hive-0.13.1 Author: Daoyuan Wang <[email protected]> Closes #3443 from adrian-wang/div and squashes the following commits: 2e98677 [Daoyuan Wang] fix code gen for divide 0 85c28ba [Daoyuan Wang] temp 36236a5 [Daoyuan Wang] add test cases 6f5716f [Daoyuan Wang] fix comments cee92bd [Daoyuan Wang] avoid evaluation 2 times 22ecd9a [Daoyuan Wang] fix style cf28c58 [Daoyuan Wang] divide fix 2dfe50f [Daoyuan Wang] return null when divider is 0 of Double type (cherry picked from commit f6df609) Signed-off-by: Michael Armbrust <[email protected]>
|
Thanks for fixing this! I've merged to master and 1.2. |
This is a follow-up of SPARK-4593 (#3443). Author: Takuya UESHIN <[email protected]> Closes #3581 from ueshin/issues/SPARK-4720 and squashes the following commits: c3959d4 [Takuya UESHIN] Make Remainder return null if the divider is 0.
SELECT max(1/0) FROM src
would return a very large number, which is obviously not right.
For hive-0.12, hive would return
Infinityfor 1/0, while for hive-0.13.1, it isNULLfor 1/0.I think it is better to keep our behavior with newer Hive version.
This PR ensures that when the divider is 0, the result of expression should be NULL, same with hive-0.13.1