cloud-fan commented on code in PR #49202:
URL: https://github.com/apache/spark/pull/49202#discussion_r1905196314
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -1783,12 +1783,12 @@ object PruneFilters extends Rule[LogicalPlan] with
PredicateHelper {
* Filter-Join-Join-Join. Most predicates can be pushed down in a single pass.
*/
object PushDownPredicates extends Rule[LogicalPlan] {
- def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
- _.containsAnyPattern(FILTER, JOIN)) {
- CombineFilters.applyLocally
- .orElse(PushPredicateThroughNonJoin.applyLocally)
- .orElse(PushPredicateThroughJoin.applyLocally)
- }
+ def apply(plan: LogicalPlan): LogicalPlan = RewriteWithExpression(
Review Comment:
We can create a dedicated RuleExecutor to run this rule
```
object PushDownPredicates extends Rule[LogicalPlan] {
val rewriteWithRuleExecutor = new RuleExecutor[LogicalPlan] {
val batches = Batch("RewriteWithExpression", fixedPoint,
RewriteWithExpression) :: Nil
}
def apply(plan: LogicalPlan): LogicalPlan =
rewriteWithRuleExecutor.execute(...)
}
```
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -1783,12 +1783,12 @@ object PruneFilters extends Rule[LogicalPlan] with
PredicateHelper {
* Filter-Join-Join-Join. Most predicates can be pushed down in a single pass.
*/
object PushDownPredicates extends Rule[LogicalPlan] {
- def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
- _.containsAnyPattern(FILTER, JOIN)) {
- CombineFilters.applyLocally
- .orElse(PushPredicateThroughNonJoin.applyLocally)
- .orElse(PushPredicateThroughJoin.applyLocally)
- }
+ def apply(plan: LogicalPlan): LogicalPlan = RewriteWithExpression(
Review Comment:
We can create a dedicated RuleExecutor to run this rule
```
object PushDownPredicates extends Rule[LogicalPlan] {
private val rewriteWithRuleExecutor = new RuleExecutor[LogicalPlan] {
val batches = Batch("RewriteWithExpression", fixedPoint,
RewriteWithExpression) :: Nil
}
def apply(plan: LogicalPlan): LogicalPlan =
rewriteWithRuleExecutor.execute(...)
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]