You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/05/17 11:46:24 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #24626: [SPARK-27747][SQL] add a logical plan link in the physical plan

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org