Skip to content

Conversation

@adrian-wang
Copy link
Contributor

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

@SparkQA
Copy link

SparkQA commented Nov 25, 2014

Test build #23821 has started for PR 3443 at commit 2dfe50f.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 25, 2014

Test build #23821 has finished for PR 3443 at commit 2dfe50f.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23821/
Test PASSed.

Copy link
Member

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.

@ueshin
Copy link
Member

ueshin commented Nov 25, 2014

Divide.nullable should be true if it returns null when the divider is 0.

@ueshin
Copy link
Member

ueshin commented Nov 25, 2014

What do you think about IntegralType?
Currently I think it throws ArithmeticException when the divider is 0.

@adrian-wang
Copy link
Contributor Author

@ueshin Thanks for your reminding, I made a mistake here.

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23865 has started for PR 3443 at commit cf28c58.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23865 has finished for PR 3443 at commit cf28c58.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23865/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23867 has started for PR 3443 at commit 22ecd9a.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23867 has finished for PR 3443 at commit 22ecd9a.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23867/
Test PASSed.

Copy link
Member

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(_, _)?

@SparkQA
Copy link

SparkQA commented Nov 27, 2014

Test build #23920 has started for PR 3443 at commit cee92bd.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 27, 2014

Test build #23920 has finished for PR 3443 at commit cee92bd.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23920/
Test PASSed.

@SparkQA
Copy link

SparkQA commented Nov 27, 2014

Test build #23922 has started for PR 3443 at commit 6f5716f.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 27, 2014

Test build #23922 has finished for PR 3443 at commit 6f5716f.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23922/
Test PASSed.

@marmbrus
Copy link
Contributor

marmbrus commented Dec 1, 2014

Can you add some test cases to the ExpressionEvaluationSuite?

@SparkQA
Copy link

SparkQA commented Dec 2, 2014

Test build #24018 has started for PR 3443 at commit 36236a5.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Dec 2, 2014

Test build #24018 has finished for PR 3443 at commit 36236a5.

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

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/24018/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Dec 2, 2014

Test build #24030 has started for PR 3443 at commit 2e98677.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Dec 2, 2014

Test build #24030 has finished for PR 3443 at commit 2e98677.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/24030/
Test PASSed.

asfgit pushed a commit that referenced this pull request Dec 2, 2014
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]>
@asfgit asfgit closed this in f6df609 Dec 2, 2014
@marmbrus
Copy link
Contributor

marmbrus commented Dec 2, 2014

Thanks for fixing this! I've merged to master and 1.2.

asfgit pushed a commit that referenced this pull request Dec 17, 2014
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.
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.

5 participants