spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] maropu commented on a change in pull request #27231: [SPARK-28478][SQL] Remove redundant null checks
Date Tue, 21 Jan 2020 02:17:46 GMT
maropu commented on a change in pull request #27231: [SPARK-28478][SQL] Remove redundant null
checks
URL: https://github.com/apache/spark/pull/27231#discussion_r368784740
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
 ##########
 @@ -483,6 +507,19 @@ object SimplifyConditionals extends Rule[LogicalPlan] with PredicateHelper
{
         } else {
           e.copy(branches = branches.take(i).map(branch => (branch._1, elseValue)))
         }
+
+      case e @ CaseWhen(branches, elseValue) if branches.length == 1 =>
+        // remove redundant null checks for CaseWhen with one branch
+        branches(0)._1 match {
+          case IsNotNull(child) if isRedundantNullCheck(
+            elseValue.getOrElse(Literal.create(null, child.dataType)),
 
 Review comment:
   `child.dataType` -> `e.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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message