Github user ueshin commented on a diff in the pull request: https://github.com/apache/spark/pull/20637#discussion_r211132711 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelperSuite.scala --- @@ -35,6 +35,24 @@ class ExpressionEvalHelperSuite extends SparkFunSuite with ExpressionEvalHelper val e = intercept[RuntimeException] { checkEvaluation(BadCodegenExpression(), 10) } assert(e.getMessage.contains("some_variable")) } + + test("SPARK-23466: checkEvaluationWithUnsafeProjection should fail if null is compared with " + + "primitive default value") { + val expected = Array(null, -1, 0, 1) + val catalystValue = CatalystTypeConverters.convertToCatalyst(expected) + + val expression1 = CreateArray( + Seq(Literal(null, IntegerType), Literal(-1), Literal(0), Literal(1))) + assert(expression1.dataType.containsNull) + checkEvaluationWithUnsafeProjection(expression1, catalystValue) + + val expression2 = CreateArray(Seq(Literal(0, IntegerType), Literal(-1), Literal(0), Literal(1))) + assert(!expression2.dataType.containsNull) + val e = intercept[RuntimeException] { + checkEvaluationWithUnsafeProjection(expression2, catalystValue) --- End diff -- We should use `checkExceptionInExpression`?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org