Uh oh!
There was an error while loading. Please reload this page.
[SPARK-32688][SQL][TEST] Add special values to LiteralGenerator for float and double - #29515
[SPARK-32688][SQL][TEST] Add special values to LiteralGenerator for float and double#29515tanelk wants to merge 8 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
tanelk
commented
Aug 22, 2020
cc @cloud-fan , this should be relevant to you |
maropu
commented
Aug 22, 2020
ok to test |
| f <- Gen.oneOf( | ||
| Gen.oneOf( | ||
| Float.NaN, Float.PositiveInfinity, Float.NegativeInfinity, Float.MinPositiveValue, | ||
| 0.0f, -0.0f, 1.0f, -1.0f), |
There was a problem hiding this comment.
Are 1.0f and -1.0f also special values?
There was a problem hiding this comment.
They aren't in the sense, that Arbitrary.arbFloat.arbitrary can generate them, but they are in the sense, that it is more likely, that a function could act weirdly at these values. For example log1p.
There was a problem hiding this comment.
Could you leave some comments in the code?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
maropu
commented
Aug 22, 2020
also cc: @srowen |
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Aug 23, 2020
Test build #127791 has finished for PR 29515 at commit
|
tanelk
commented
Aug 23, 2020
This failure is discovered by this change, not caused. Should that be fixed by a separate pull request? Not sure which of the two is the correct behavior. |
srowen
commented
Aug 23, 2020
I think we can't commit a change that causes tests to fail of course. The fix of the tests would have to go with the fix in underlying code as needed. |
tanelk
commented
Aug 23, 2020
retest this please |
I meant, that it could be fixed in another PR, before this PR is merged |
SparkQA
commented
Aug 23, 2020
Test build #127794 has finished for PR 29515 at commit
|
maropu
commented
Aug 23, 2020
Could you file jira and fix it? |
tanelk
commented
Aug 23, 2020
There is a related issue with -0.0: https://issues.apache.org/jira/browse/SPARK-32110 |
| // +---------+---------+---------+---------+ | ||
| protected override def nullSafeEval(left: Any, right: Any): Any = ordering.equiv(left, right) | ||
| protected override def nullSafeEval(left: Any, right: Any): Any = { | ||
| left == right || ordering.equiv(left, right) |
There was a problem hiding this comment.
At least, we shoud fix the existing test failures that we found in this PR. But, this fix looks improper, so could we use NormalizeNaNAndZero instead? cc: @cloud-fan@viirya
There was a problem hiding this comment.
NormalizeNaNAndZero can't help here, because checkConsistencyBetweenInterpretedAndCodegen is done without optimizers.
Also it could introduce new correctness issues with atan2(-0.0, x) and 1.0 / -0.0.
There was a problem hiding this comment.
I assumed that 0.0 == -0.0 is the expected behavior, but if it is not, then we could leave this as it was change the code gen path.
There was a problem hiding this comment.
But, how about the case array(-0.0) == array(0.0)?
There was a problem hiding this comment.
You are 100% correct.
It is an interesting problem, where the same comparator is used for both sorting and equality check.
For sorting -0.0 should be smaller than 0.0, but in equality check they should be equal.
Just for reference, it seems that both hive and mysql consider them equal in the equality check:
https://issues.apache.org/jira/browse/HIVE-11174
SparkQA
commented
Aug 23, 2020
Test build #127808 has finished for PR 29515 at commit
|
SparkQA
commented
Aug 23, 2020
Test build #127807 has finished for PR 29515 at commit
|
SparkQA
commented
Aug 24, 2020
Test build #127816 has finished for PR 29515 at commit
|
tanelk
commented
Aug 24, 2020
There is a |
cloud-fan
commented
Aug 24, 2020
This is a good catch! Let's fix the found bugs one by one and merge this PR at the end. @tanelk is this the only bug we found so far? https://issues.apache.org/jira/browse/SPARK-32110 |
tanelk
commented
Aug 24, 2020
Currently yes, the |
SparkQA
commented
Aug 24, 2020
Test build #127840 has finished for PR 29515 at commit
|
tanelk
commented
Aug 24, 2020
This is a new finding. But also related to the |
SparkQA
commented
Sep 4, 2020
Test build #128299 has finished for PR 29515 at commit
|
tanelk
commented
Sep 11, 2020
@cloud-fan, now that #29647 is merged, can this be merged also? |
maropu
commented
Sep 15, 2020
Are all the bugs that this PR found already fixed now? |
maropu
commented
Sep 15, 2020
retest this please |
tanelk
commented
Sep 15, 2020
I believe, that they were the manifestation of the |
SparkQA
commented
Sep 15, 2020
Test build #128688 has finished for PR 29515 at commit
|
maropu
commented
Sep 15, 2020
retest this please |
SparkQA
commented
Sep 15, 2020
Test build #128707 has finished for PR 29515 at commit
|
cloud-fan
commented
Sep 15, 2020
hmm, does this PR catch https://issues.apache.org/jira/browse/SPARK-32110 ? |
That's more of an umbrella jira, that mainly covers inconsistency between operators. Just to be safe, we could trigger some retests on this. |
maropu
commented
Sep 15, 2020
retest this please |
SparkQA
commented
Sep 15, 2020
Test build #128717 has finished for PR 29515 at commit
|
…loat and double ### What changes were proposed in this pull request? The `LiteralGenerator` for float and double datatypes was supposed to yield special values (NaN, +-inf) among others, but the `Gen.chooseNum` method does not yield values that are outside the defined range. The `Gen.chooseNum` for a wide range of floats and doubles does not yield values in the "everyday" range as stated in typelevel/scalacheck#113 . There is an similar class `RandomDataGenerator` that is used in some other tests. Added `-0.0` and `-0.0f` as special values to there too. These changes revealed an inconsistency with the equality check between `-0.0` and `0.0`. ### Why are the changes needed? The `LiteralGenerator` is mostly used in the `checkConsistencyBetweenInterpretedAndCodegen` method in `MathExpressionsSuite`. This change would have caught the bug fixed in #29495 . ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Locally reverted #29495 and verified that the existing test cases caught the bug. Closes#29515 from tanelk/SPARK-32688. Authored-by: Tanel Kiis <tanel.kiis@gmail.com> Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org> (cherry picked from commit 6051755) Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
maropu
commented
Sep 16, 2020
Merged to master/3.0. To check if no flaky tests happens, I will keep watching Jenkins jobs. Anyway, thanks, @tanelk ! |
…loat and double ### What changes were proposed in this pull request? The `LiteralGenerator` for float and double datatypes was supposed to yield special values (NaN, +-inf) among others, but the `Gen.chooseNum` method does not yield values that are outside the defined range. The `Gen.chooseNum` for a wide range of floats and doubles does not yield values in the "everyday" range as stated in typelevel/scalacheck#113 . There is an similar class `RandomDataGenerator` that is used in some other tests. Added `-0.0` and `-0.0f` as special values to there too. These changes revealed an inconsistency with the equality check between `-0.0` and `0.0`. ### Why are the changes needed? The `LiteralGenerator` is mostly used in the `checkConsistencyBetweenInterpretedAndCodegen` method in `MathExpressionsSuite`. This change would have caught the bug fixed in apache#29495 . ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Locally reverted apache#29495 and verified that the existing test cases caught the bug. Closesapache#29515 from tanelk/SPARK-32688. Authored-by: Tanel Kiis <tanel.kiis@gmail.com> Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org> (cherry picked from commit 6051755) Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
What changes were proposed in this pull request?
The
LiteralGeneratorfor float and double datatypes was supposed to yield special values (NaN, +-inf) among others, but theGen.chooseNummethod does not yield values that are outside the defined range. TheGen.chooseNumfor a wide range of floats and doubles does not yield values in the "everyday" range as stated in typelevel/scalacheck#113 .There is an similar class
RandomDataGeneratorthat is used in some other tests. Added-0.0and-0.0fas special values to there too.These changes revealed an inconsistency with the equality check between
-0.0and0.0.Why are the changes needed?
The
LiteralGeneratoris mostly used in thecheckConsistencyBetweenInterpretedAndCodegenmethod inMathExpressionsSuite. This change would have caught the bug fixed in #29495 .Does this PR introduce any user-facing change?
No
How was this patch tested?
Locally reverted #29495 and verified that the existing test cases caught the bug.