maropu commented on a change in pull request #24258: 
[SPARK-27279][SQL][FOLLOW-UP] Reuse subquery should compare child plan of 
`SubqueryExec`
URL: https://github.com/apache/spark/pull/24258#discussion_r270697177
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/basicPhysicalOperators.scala
 ##########
 @@ -715,3 +726,29 @@ object SubqueryExec {
   private[execution] val executionContext = 
ExecutionContext.fromExecutorService(
     ThreadUtils.newDaemonCachedThreadPool("subquery", 16))
 }
+
+/**
+ * A wrapper for reused [[BaseSubqueryExec]].
+ */
+case class ReusedSubqueryExec(child: BaseSubqueryExec)
+  extends BaseSubqueryExec with LeafExecNode {
+
+  override def name: String = child.name
+
+  override def output: Seq[Attribute] = child.output
+  override def doCanonicalize(): SparkPlan = child.canonicalized
+  override def outputOrdering: Seq[SortOrder] = child.outputOrdering
+  override def outputPartitioning: Partitioning = child.outputPartitioning
+
+  protected override def doPrepare(): Unit = {
+    child.prepare()
+  }
+
+  protected override def doExecute(): RDD[InternalRow] = {
+    child.execute()
+  }
+
+  override def executeCollect(): Array[InternalRow] = {
+    child.executeCollect()
+  }
 
 Review comment:
   super nit: 
   ```
     protected override def doPrepare(): Unit = child.prepare()
     protected override def doExecute(): RDD[InternalRow] = child.execute()
     override def executeCollect(): Array[InternalRow] = child.executeCollect()
   ```

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