cloud-fan commented on code in PR #49518: URL: https://github.com/apache/spark/pull/49518#discussion_r1927047109
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveWithCTE.scala: ########## @@ -183,4 +187,52 @@ object ResolveWithCTE extends Rule[LogicalPlan] { columnNames.map(UnresolvedSubqueryColumnAliases(_, ref)).getOrElse(ref) } } + + /** + * Checks if there is any self-reference within subqueries and throws an error + * if that is the case. + */ + private def checkForSelfReferenceInSubquery(cteDef: CTERelationDef): Unit = { + cteDef.subqueriesAll.foreach { subquery => + subquery.foreach { + case CTERelationRef(cteDef.id, _, _, _, _, true) => Review Comment: let's compare the CTE id -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org