milanisvet commented on PR #49518: URL: https://github.com/apache/spark/pull/49518#issuecomment-2610141675
> As discussed offline about subqueries: > > 1. The bug in `CTESubstitution` that self-references within subqueries are not substituted is fixed now. > 2. We agreed that we don't want to resolve self-references within subqueries at all, therefore, we can not perform the check about this in `checkAnalysis`, but rather in `ResolveWithCTE`. > 3. More thorough explanation: check in `checkAnalysis` would require `union`->`unionLoop` substitution, so that we still have `cteId` even if the CTE is inlined. However, only substituting `union`->`unionLoop` and not `CTERelationRef`->`UnionLoopRef` would make the current `ResolveWithCTE` code behave as not intended. We don't want to perform second substitution as we agreed not to resolve self-references within subqueries Check about self references in subqueries moved back to checkAnalysis and performed in different way, in order not to have to check it reapeatedly in ResolveWithCTE (fixedPoint rule, in contrast checkAnalysis performed only once) -- 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