-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-36792][SQL] InSet should handle NaN #34033
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 #143421 has finished for PR 34033 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143431 has finished for PR 34033 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143440 has finished for PR 34033 at commit
|
|
Test build #143527 has finished for PR 34033 at commit
|
|
ping @cloud-fan |
| if (set.contains(value)) { | ||
| true | ||
| } else if (isNaN(value)) { | ||
| set.exists(isNaN(_)) |
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.
can we have a hasNaN variable to avoid repeated computing?
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.
How about current?
|
Kubernetes integration test starting |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Kubernetes integration test status failure |
|
Kubernetes integration test starting |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Kubernetes integration test status failure |
| case FloatType => (value: Any) => java.lang.Float.isNaN(value.asInstanceOf[java.lang.Float]) | ||
| case _ => (_: Any) => false | ||
| } | ||
| @transient private[this] lazy val hasNaN = set.exists(isNaN) |
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.
nit: we can avoid iterating the set if type is not float/double.
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.
nit: we can avoid iterating the set if type is not float/double.
DOne
|
Test build #143528 has finished for PR 34033 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143533 has finished for PR 34033 at commit
|
|
Test build #143541 has finished for PR 34033 at commit
|
| private def genCodeWithSet(ctx: CodegenContext, ev: ExprCode): ExprCode = { | ||
| nullSafeCodeGen(ctx, ev, c => { | ||
| val setTerm = ctx.addReferenceObj("set", set) | ||
| val hasNaNValue = ctx.addReferenceObj("hasNaN", hasNaN) |
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.
hasNaN is a boolean, we can just use it to generate code
|} else if (${isNaN(c)}) {
| ${ev.value} = $hasNaN;
|}
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.
Done
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
Show resolved
Hide resolved
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143554 has finished for PR 34033 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143583 has finished for PR 34033 at commit
|
|
thanks, merging to master/3.2/3.1/3.0! |
### What changes were proposed in this pull request? InSet should handle NaN ``` InSet(Literal(Double.NaN), Set(Double.NaN, 1d)) should return true, but return false. ``` ### Why are the changes needed? InSet should handle NaN ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added UT Closes #34033 from AngersZhuuuu/SPARK-36792. Authored-by: Angerszhuuuu <[email protected]> Signed-off-by: Wenchen Fan <[email protected]> (cherry picked from commit 64f4bf4) Signed-off-by: Wenchen Fan <[email protected]>
### What changes were proposed in this pull request? InSet should handle NaN ``` InSet(Literal(Double.NaN), Set(Double.NaN, 1d)) should return true, but return false. ``` ### Why are the changes needed? InSet should handle NaN ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added UT Closes #34033 from AngersZhuuuu/SPARK-36792. Authored-by: Angerszhuuuu <[email protected]> Signed-off-by: Wenchen Fan <[email protected]> (cherry picked from commit 64f4bf4) Signed-off-by: Wenchen Fan <[email protected]>
### What changes were proposed in this pull request? InSet should handle NaN ``` InSet(Literal(Double.NaN), Set(Double.NaN, 1d)) should return true, but return false. ``` ### Why are the changes needed? InSet should handle NaN ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added UT Closes #34033 from AngersZhuuuu/SPARK-36792. Authored-by: Angerszhuuuu <[email protected]> Signed-off-by: Wenchen Fan <[email protected]> (cherry picked from commit 64f4bf4) Signed-off-by: Wenchen Fan <[email protected]>
### What changes were proposed in this pull request? InSet should handle NaN ``` InSet(Literal(Double.NaN), Set(Double.NaN, 1d)) should return true, but return false. ``` ### Why are the changes needed? InSet should handle NaN ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added UT Closes apache#34033 from AngersZhuuuu/SPARK-36792. Authored-by: Angerszhuuuu <[email protected]> Signed-off-by: Wenchen Fan <[email protected]> (cherry picked from commit 64f4bf4) Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
InSet should handle NaN
Why are the changes needed?
InSet should handle NaN
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added UT