rdblue commented on a change in pull request #24763: [SPARK-27909][SQL] Do not
run analysis inside CTE substitution
URL: https://github.com/apache/spark/pull/24763#discussion_r290462719
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -215,23 +215,26 @@ class Analyzer(
object CTESubstitution extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsUp {
case With(child, relations) =>
- substituteCTE(child, relations.foldLeft(Seq.empty[(String,
LogicalPlan)]) {
- case (resolved, (name, relation)) =>
- resolved :+ name -> executeSameContext(substituteCTE(relation,
resolved))
- })
+ // substitute CTE expressions right-to-left to resolve references to
previous CTEs:
+ // with a as (select * from t) with b as (select * from a) select *
from b
Review comment:
Done.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]