dongjoon-hyun commented on a change in pull request #24842: [SPARK-28002][SQL] 
Support WITH clause column aliases
URL: https://github.com/apache/spark/pull/24842#discussion_r293223242
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
 ##########
 @@ -81,18 +81,31 @@ class PlanParserSuite extends AnalysisTest {
     assertEqual("select * from a intersect all select * from b", 
a.intersect(b, isAll = true))
   }
 
+  private def cte(plan: LogicalPlan, namedPlans: (String, (LogicalPlan, 
Seq[String]))*): With = {
+    val ctes = namedPlans.map {
+      case (name, (cte, columnAliases)) =>
+        val subquery = if (columnAliases.isEmpty) {
+          cte
+        } else {
+          UnresolvedSubqueryColumnAliases(columnAliases, cte)
+        }
+        name -> SubqueryAlias(name, subquery)
+    }
+    With(plan, ctes)
+  }
 
 Review comment:
   Oh, this PR is already updated to the master. Then, please move this 
function to the below of the existing `cte` function. We had better gather the 
similar functions. If possible, please consolidate them into one.

----------------------------------------------------------------
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]

Reply via email to