mgaido91 commented on a change in pull request #23531: [SPARK-24497][SQL] 
Support recursive SQL query
URL: https://github.com/apache/spark/pull/23531#discussion_r247537386
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/basicPhysicalOperators.scala
 ##########
 @@ -225,6 +226,57 @@ case class FilterExec(condition: Expression, child: 
SparkPlan)
   override def outputPartitioning: Partitioning = child.outputPartitioning
 }
 
+/** Physical plan for RecursiveTable. */
+case class RecursiveTableExec(
+    name: String,
+    anchorTerm: SparkPlan,
+    recursiveTerm: SparkPlan) extends SparkPlan {
+  override def children: Seq[SparkPlan] = Seq(anchorTerm, recursiveTerm)
+
+  override def output: Seq[Attribute] = anchorTerm.output
+
+  override val doNotPrepareInAdvance: Seq[SparkPlan] = Seq(recursiveTerm)
+
+  override protected def doExecute(): RDD[InternalRow] = {
+    var temp = anchorTerm.execute().map(_.copy()).cache()
+    var tempCount = temp.count()
+    var result = temp
+    var level = 0
+    do {
+      if (level > conf.getConf(SQLConf.RECURSION_LEVEL_LIMIT)) {
+        throw new SparkException(s"Recursion level limit reached but query 
hasn't exhausted, try " +
 
 Review comment:
   nit: no `s`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to