davidvrba commented on a change in pull request #27231: [SPARK-28478][SQL]
Remove redundant null checks
URL: https://github.com/apache/spark/pull/27231#discussion_r369221877
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimplifyConditionalSuite.scala
##########
@@ -35,18 +35,24 @@ class SimplifyConditionalSuite extends PlanTest with
PredicateHelper {
}
protected def assertEquivalent(e1: Expression, e2: Expression): Unit = {
- val correctAnswer = Project(Alias(e2, "out")() :: Nil,
OneRowRelation()).analyze
- val actual = Optimize.execute(Project(Alias(e1, "out")() :: Nil,
OneRowRelation()).analyze)
+ val correctAnswer = Project(Alias(e2, "out")() :: Nil,
LocalRelation('a.int)).analyze
+ val actual = Optimize.execute(
+ Project(Alias(e1, "out")() :: Nil, LocalRelation('a.int)).analyze)
comparePlans(actual, correctAnswer)
}
private val trueBranch = (TrueLiteral, Literal(5))
private val normalBranch = (NonFoldableLiteral(true), Literal(10))
private val unreachableBranch = (FalseLiteral, Literal(20))
- private val nullBranch = (Literal.create(null, NullType), Literal(30))
-
- val isNotNullCond = IsNotNull(UnresolvedAttribute(Seq("a")))
- val isNullCond = IsNull(UnresolvedAttribute("b"))
+ private val nullValue = Literal.create(null, IntegerType)
Review comment:
I need the same dataType as i have for the `a` attribute. But i can just add
another nullValue to the test and keep the previous with the original dataType.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]