cloud-fan commented on a change in pull request #30853:
URL: https://github.com/apache/spark/pull/30853#discussion_r549458098
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,29 +542,42 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan]
with PredicateHelper {
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
case q: LogicalPlan => q transformExpressionsUp {
+ case a: Alias => a // Skip an alias.
Review comment:
`Alias` is not the only exception, we can't apply this optimization for
`Generator` as well, as the logical plan `Generate` requires explicit type
`Generator`.
It happened many times that an optimization rule introduces bugs because it
uses denylist instead of allowlist. Let's avoid similar mistakes here, and
explicitly list what expressions we should support.
An initial list from my mind:
1. IsNull, IsNotNull
2. UnaryMathExpression
3. String2StringExpression
4. Cast
5. BinaryComparison
6. BinaryArithmetic
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]