Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Dec 4, 2019

What changes were proposed in this pull request?

Follow up on #26654 (comment)
Instead of OrderingUtil or Utils.nanSafeCompare{Doubles,Floats}, just use java.lang.{Double,Float}.compare directly. All work identically w.r.t. NaN when used to compare.

Why are the changes needed?

Simplification of the previous change, which existed to support Scala 2.13 migration.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests

@SparkQA
Copy link

SparkQA commented Dec 4, 2019

Test build #114878 has finished for PR 26761 at commit 9a7b3e1.

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

@SparkQA
Copy link

SparkQA commented Dec 5, 2019

Test build #114882 has finished for PR 26761 at commit d359b9b.

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

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in ebd83a5 Dec 5, 2019
@HyukjinKwon
Copy link
Member

LGTM too

@srowen srowen deleted the SPARK-30009.2 branch December 6, 2019 19:06
attilapiros pushed a commit to attilapiros/spark that referenced this pull request Dec 6, 2019
…afeCompare{Doubles,Floats} and use java.lang.{Double,Float}.compare directly

### What changes were proposed in this pull request?

Follow up on apache#26654 (comment)
Instead of OrderingUtil or Utils.nanSafeCompare{Doubles,Floats}, just use java.lang.{Double,Float}.compare directly. All work identically w.r.t. NaN when used to `compare`.

### Why are the changes needed?

Simplification of the previous change, which existed to support Scala 2.13 migration.

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

Existing tests

Closes apache#26761 from srowen/SPARK-30009.2.

Authored-by: Sean Owen <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
dongjoon-hyun pushed a commit that referenced this pull request Sep 8, 2020
### What changes were proposed in this pull request?

This is a Spark 3.0 regression introduced by #26761. We missed a corner case that `java.lang.Double.compare` treats 0.0 and -0.0 as different, which breaks SQL semantic.

This PR adds back the `OrderingUtil`, to provide custom compare methods that take care of 0.0 vs -0.0

### Why are the changes needed?

Fix a correctness bug.

### Does this PR introduce _any_ user-facing change?

Yes, now `SELECT  0.0 > -0.0` returns false correctly as Spark 2.x.

### How was this patch tested?

new tests

Closes #29647 from cloud-fan/float.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun pushed a commit that referenced this pull request Sep 8, 2020
This is a Spark 3.0 regression introduced by #26761. We missed a corner case that `java.lang.Double.compare` treats 0.0 and -0.0 as different, which breaks SQL semantic.

This PR adds back the `OrderingUtil`, to provide custom compare methods that take care of 0.0 vs -0.0

Fix a correctness bug.

Yes, now `SELECT  0.0 > -0.0` returns false correctly as Spark 2.x.

new tests

Closes #29647 from cloud-fan/float.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 4144b6d)
Signed-off-by: Dongjoon Hyun <[email protected]>
holdenk pushed a commit to holdenk/spark that referenced this pull request Oct 27, 2020
This is a Spark 3.0 regression introduced by apache#26761. We missed a corner case that `java.lang.Double.compare` treats 0.0 and -0.0 as different, which breaks SQL semantic.

This PR adds back the `OrderingUtil`, to provide custom compare methods that take care of 0.0 vs -0.0

Fix a correctness bug.

Yes, now `SELECT  0.0 > -0.0` returns false correctly as Spark 2.x.

new tests

Closes apache#29647 from cloud-fan/float.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 4144b6d)
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants