sigmod commented on a change in pull request #32439:
URL: https://github.com/apache/spark/pull/32439#discussion_r629828096



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -745,7 +754,8 @@ object PushProjectionThroughUnion extends Rule[LogicalPlan] 
with PredicateHelper
  */
 object ColumnPruning extends Rule[LogicalPlan] {
 
-  def apply(plan: LogicalPlan): LogicalPlan = removeProjectBeforeFilter(plan 
transform {
+  def apply(plan: LogicalPlan): LogicalPlan = removeProjectBeforeFilter(
+    plan.transformWithPruning(AlwaysProcess.fn, ruleId) {

Review comment:
       `transform` internally calls
   `transformWithPruning(AlwaysProcess.fn, UnknownRuleId)` ...
   
   The argument comments are here:
   
https://github.com/apache/spark/blob/e08c40fa3f7054bdc713873c99d3aaf0014d9314/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala#L434-L441
   
    So here, 
    `plan.transformWithPruning(AlwaysProcess.fn, ruleId)` means there's no 
pruning based on TreePattern bits, but there's pruning based on ruleIds (if the 
rule is known to ineffective on a tree instance `T`,  it will be skipped next 
time when it is invoked on the same tree instance `T`).




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

Reply via email to