You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/12/22 11:50:14 UTC

[PR] [SPARK-46484][SQL][CONNECT] Make `resolveOperators*` functions keep the plan id [spark]

zhengruifeng opened a new pull request, #44462:
URL: https://github.com/apache/spark/pull/44462

   ### What changes were proposed in this pull request?
   make following helper functions keep the plan id in transformation:
   
   - `resolveOperatorsUpWithPruning`
   - `resolveOperatorsDownWithPruning`
   - `resolveOperatorsUpWithNewOutput`
   
   ### Why are the changes needed?
   we had make following rules keep the plan id:
   1, `ResolveNaturalAndUsingJoin` in https://github.com/apache/spark/commit/167bbca49c1c12ccd349d4330862c136b38d4522
   2, `ExtractWindowExpressions` in https://github.com/apache/spark/commit/185a0a5a23958676e4236eaf9e4d78cdfd2dd2d7
   3, `WidenSetOperationTypes` in https://github.com/apache/spark/commit/17c206fb71d03aefa75ecb87ca82772980dab954
   4, `ResolvePivot` in https://github.com/apache/spark/commit/1a89bdc60d55394a1a9d94d4fa69fa5ab8041671
   5, `CTESubstitution` in https://github.com/apache/spark/commit/79d1cded8555c5a0cc97b76747753785477eab8f
   
   But plan id missing issue still keep popping up, so this PR attempt to cover more cases by fixing the helper functions to build the rule
   
   ### Does this PR introduce _any_ user-facing change?
   no
   
   
   ### How was this patch tested?
   ut
   
   revert previous changes in the rules
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   no
   


-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-46484][SQL][CONNECT] Make `resolveOperators*` helper functions keep the plan id [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #44462:
URL: https://github.com/apache/spark/pull/44462#discussion_r1437620379


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/AnalysisHelper.scala:
##########
@@ -177,10 +177,14 @@ trait AnalysisHelper extends QueryPlan[LogicalPlan] { self: LogicalPlan =>
             self.markRuleAsIneffective(ruleId)
             self
           } else {
+            rewritten_plan.copyTagsFrom(self)
             rewritten_plan
           }
         } else {
-          afterRule.mapChildren(_.resolveOperatorsDownWithPruning(cond, ruleId)(rule))
+          val newPlan = afterRule
+            .mapChildren(_.resolveOperatorsDownWithPruning(cond, ruleId)(rule))
+          newPlan.copyTagsFrom(self)
+          newPlan
         }
       }

Review Comment:
   This method `resolveOperatorsDownWithPruning` is very similar to `TreeNode#transformDownWithPruning`. Would be good if we can refactor and unify them. cc @beliefer 



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-46484][SQL][CONNECT] Make `resolveOperators*` helper functions keep the plan id [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #44462:
URL: https://github.com/apache/spark/pull/44462#issuecomment-1871095503

   @cloud-fan I think it is ready for a review


-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-46484][WIP][SQL][CONNECT] Make `resolveOperators*` functions keep the plan id [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #44462:
URL: https://github.com/apache/spark/pull/44462#issuecomment-1868407055

   cc @cloud-fan @HyukjinKwon 


-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-46484][SQL][CONNECT] Make `resolveOperators*` helper functions keep the plan id [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #44462:
URL: https://github.com/apache/spark/pull/44462#issuecomment-1871661552

   thanks @cloud-fan and @HyukjinKwon 
   
   merged to master


-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [WIP][SPARK-46484][SQL][CONNECT] Make `resolveOperators*` functions keep the plan id [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #44462:
URL: https://github.com/apache/spark/pull/44462#issuecomment-1868604893

   I converted it to `Draft` because of `[WIP]` tag, @zhengruifeng .


-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-46484][SQL][CONNECT] Make `resolveOperators*` helper functions keep the plan id [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #44462: [SPARK-46484][SQL][CONNECT] Make `resolveOperators*` helper functions keep the plan id
URL: https://github.com/apache/spark/pull/44462


-- 
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: reviews-unsubscribe@spark.apache.org

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