cloud-fan commented on code in PR #47180:
URL: https://github.com/apache/spark/pull/47180#discussion_r1666180057
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CollectCTEDefinitions.scala:
##########
@@ -282,11 +283,15 @@ object CTESubstitution extends Rule[LogicalPlan] {
if (alwaysInline) {
d.child
} else {
- // Add a `SubqueryAlias` for hint-resolving rules to match
relation names.
- SubqueryAlias(table, CTERelationRef(d.id, d.resolved, d.output,
d.isStreaming))
+ // Add unresolved with CTE relations to the plan and we
+ // will do CTE resolution later in analyzer based on this node.
+ UnresolvedWithCTERelations(u, cteRelations)
Review Comment:
Thinking more about it, I think we can still return `SubqueryAlias(...)` as
before here, which is like a shortcut as we know we should look up CTE
relations first when resolving `UnresolvedRelation`. There is no need to delay
it.
--
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]