You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/21 12:19:12 UTC
[GitHub] [spark] maropu commented on a change in pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches
maropu commented on a change in pull request #30853:
URL: https://github.com/apache/spark/pull/30853#discussion_r546675164
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,29 +542,41 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
case q: LogicalPlan => q transformExpressionsUp {
+ case u @ UnaryExpression(i @ If(_, trueValue, falseValue))
+ if !u.isInstanceOf[Alias] && atMostOneUnfoldable(Seq(trueValue, falseValue)) =>
Review comment:
nit: How about this?
```
case q: LogicalPlan => q transformExpressionsUp {
case a: Alias => a // Skip an alias
case u @ UnaryExpression(i @ If(_, trueValue, falseValue))
if atMostOneUnfoldable(Seq(trueValue, falseValue)) => ...
```
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org