milanisvet commented on code in PR #49232:
URL: https://github.com/apache/spark/pull/49232#discussion_r1898641347
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CTESubstitution.scala:
##########
@@ -308,7 +399,10 @@ object CTESubstitution extends Rule[LogicalPlan] {
p.copy(planBuilder = (nameParts, children) => {
p.planBuilder.apply(nameParts, children) match {
case u @ UnresolvedRelation(Seq(table), _, _) =>
- resolveWithCTERelations(table, alwaysInline, cteRelations, u)
+ val resolved = resolveWithCTERelations(table, alwaysInline,
+ (recursiveCTERelation ++ cteRelations).toSeq, u)
+ recursionFound = resolved._2
Review Comment:
As we agreed, we won't support the case with identifier in recursive CTE. I
added an exception here for that. The error is thrown in case
recursiveCTERelation is not None. recursiveCTERelation set to be not None in
resolveCTERelations in case allowRecursion is True (meaning we are under
recursive CTE - `WITH RECURSIVE` specified).
However, maybe it would be better and more clean to pass down the flag
`allowRecursion` to `substituteCTE`. What do you think?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]