cloud-fan commented on a change in pull request #24626: [SPARK-27747][SQL] add 
a logical plan link in the physical plan
URL: https://github.com/apache/spark/pull/24626#discussion_r285090139
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala
 ##########
 @@ -63,6 +63,17 @@ case class PlanLater(plan: LogicalPlan) extends 
LeafExecNode {
 abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
   self: SparkPlanner =>
 
+  override def plan(plan: LogicalPlan): Iterator[SparkPlan] = {
+    super.plan(plan).map { p =>
+      val logicalPlan = plan match {
+        case ReturnAnswer(rootPlan) => rootPlan
+        case _ => plan
+      }
+      p.tags += QueryPlan.LOGICAL_PLAN_TAG_NAME -> logicalPlan
 
 Review comment:
   This pattern is called stackable traits in Scala. When `super.plan` is 
called, its recursive `plan` call points to this overridden version.
   
   You can also see from the tests that, not only the root node has the logical 
plan link.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to