-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-21228][SQL] InSet incorrect handling of structs #18455
Changes from 14 commits
03a4281
72cf1d1
2c96a8d
fa11b0b
21ad3aa
7f78cce
eea2e5d
b30788e
38a0347
1057abe
a1bceda
8f2fc89
91d87af
7f69638
58c3022
c2b71a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,8 @@ class PredicateSuite extends SparkFunSuite with ExpressionEvalHelper { | |
test(s"3VL $name") { | ||
truthTable.foreach { | ||
case (l, r, answer) => | ||
val expr = op(NonFoldableLiteral(l, BooleanType), NonFoldableLiteral(r, BooleanType)) | ||
val expr = op(NonFoldableLiteral.create(l, BooleanType), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why these changes? i.e. adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is that |
||
NonFoldableLiteral.create(r, BooleanType)) | ||
checkEvaluation(expr, answer) | ||
} | ||
} | ||
|
@@ -72,7 +73,7 @@ class PredicateSuite extends SparkFunSuite with ExpressionEvalHelper { | |
(false, true) :: | ||
(null, null) :: Nil | ||
notTrueTable.foreach { case (v, answer) => | ||
checkEvaluation(Not(NonFoldableLiteral(v, BooleanType)), answer) | ||
checkEvaluation(Not(NonFoldableLiteral.create(v, BooleanType)), answer) | ||
} | ||
checkConsistencyBetweenInterpretedAndCodegen(Not, BooleanType) | ||
} | ||
|
@@ -120,22 +121,26 @@ class PredicateSuite extends SparkFunSuite with ExpressionEvalHelper { | |
(null, null, null) :: Nil) | ||
|
||
test("IN") { | ||
checkEvaluation(In(NonFoldableLiteral(null, IntegerType), Seq(Literal(1), Literal(2))), null) | ||
checkEvaluation(In(NonFoldableLiteral(null, IntegerType), | ||
Seq(NonFoldableLiteral(null, IntegerType))), null) | ||
checkEvaluation(In(NonFoldableLiteral(null, IntegerType), Seq.empty), null) | ||
checkEvaluation(In(NonFoldableLiteral.create(null, IntegerType), Seq(Literal(1), | ||
Literal(2))), null) | ||
checkEvaluation(In(NonFoldableLiteral.create(null, IntegerType), | ||
Seq(NonFoldableLiteral.create(null, IntegerType))), null) | ||
checkEvaluation(In(NonFoldableLiteral.create(null, IntegerType), Seq.empty), null) | ||
checkEvaluation(In(Literal(1), Seq.empty), false) | ||
checkEvaluation(In(Literal(1), Seq(NonFoldableLiteral(null, IntegerType))), null) | ||
checkEvaluation(In(Literal(1), Seq(Literal(1), NonFoldableLiteral(null, IntegerType))), true) | ||
checkEvaluation(In(Literal(2), Seq(Literal(1), NonFoldableLiteral(null, IntegerType))), null) | ||
checkEvaluation(In(Literal(1), Seq(NonFoldableLiteral.create(null, IntegerType))), null) | ||
checkEvaluation(In(Literal(1), Seq(Literal(1), NonFoldableLiteral.create(null, IntegerType))), | ||
true) | ||
checkEvaluation(In(Literal(2), Seq(Literal(1), NonFoldableLiteral.create(null, IntegerType))), | ||
null) | ||
checkEvaluation(In(Literal(1), Seq(Literal(1), Literal(2))), true) | ||
checkEvaluation(In(Literal(2), Seq(Literal(1), Literal(2))), true) | ||
checkEvaluation(In(Literal(3), Seq(Literal(1), Literal(2))), false) | ||
checkEvaluation( | ||
And(In(Literal(1), Seq(Literal(1), Literal(2))), In(Literal(2), Seq(Literal(1), Literal(2)))), | ||
And(In(Literal(1), Seq(Literal(1), Literal(2))), In(Literal(2), Seq(Literal(1), | ||
Literal(2)))), | ||
true) | ||
|
||
val ns = NonFoldableLiteral(null, StringType) | ||
val ns = NonFoldableLiteral.create(null, StringType) | ||
checkEvaluation(In(ns, Seq(Literal("1"), Literal("2"))), null) | ||
checkEvaluation(In(ns, Seq(ns)), null) | ||
checkEvaluation(In(Literal("a"), Seq(ns)), null) | ||
|
@@ -155,7 +160,7 @@ class PredicateSuite extends SparkFunSuite with ExpressionEvalHelper { | |
case _ => value | ||
} | ||
} | ||
val input = inputData.map(NonFoldableLiteral(_, t)) | ||
val input = inputData.map(NonFoldableLiteral.create(_, t)) | ||
val expected = if (inputData(0) == null) { | ||
null | ||
} else if (inputData.slice(1, 10).contains(inputData(0))) { | ||
|
@@ -279,7 +284,7 @@ class PredicateSuite extends SparkFunSuite with ExpressionEvalHelper { | |
test("BinaryComparison: null test") { | ||
// Use -1 (default value for codegen) which can trigger some weird bugs, e.g. SPARK-14757 | ||
val normalInt = Literal(-1) | ||
val nullInt = NonFoldableLiteral(null, IntegerType) | ||
val nullInt = NonFoldableLiteral.create(null, IntegerType) | ||
|
||
def nullTest(op: (Expression, Expression) => Expression): Unit = { | ||
checkEvaluation(op(normalInt, nullInt), null) | ||
|
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.
no space near
()
please,.getInterpretedOrdering(child.dataType))