spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] cloud-fan commented on a change in pull request #26294: [SPARK-28477] [SQL] Rewrite CaseWhen with single branch to If
Date Tue, 05 Nov 2019 15:57:39 GMT
cloud-fan commented on a change in pull request #26294: [SPARK-28477] [SQL] Rewrite CaseWhen
with single branch to If
URL: https://github.com/apache/spark/pull/26294#discussion_r342639301
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
 ##########
 @@ -435,6 +435,11 @@ object SimplifyConditionals extends Rule[LogicalPlan] with PredicateHelper
{
           e.copy(branches = newBranches)
         }
 
+      case e @ CaseWhen(branches, elseValue) if branches.length == 1 =>
 
 Review comment:
   This is not a pure logical optimization as it relies on physical info (how well is codegen
implemented)
   
   Maybe better to make it a physical optimziation, e.g. in `CaseWhen.doGenCode`, if it only
has one branch, construct a `If` expression and call its `doGenCode` instead.

----------------------------------------------------------------
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