mgaido91 commented on a change in pull request #23531: [SPARK-24497][SQL]
Support recursive SQL query
URL: https://github.com/apache/spark/pull/23531#discussion_r247443154
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -1530,6 +1689,19 @@ class Analyzer(
object GlobalAggregates extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperators {
case Project(projectList, child) if containsAggregates(projectList) =>
+
+ def traversePlanAndCheck(plan: LogicalPlan, inRecursiveTable: Boolean
= false): Unit =
+ plan match {
+ case RecursiveReference(name, _) if !inRecursiveTable =>
+ throw new AnalysisException(s"Recursive reference ${name} can't
be used in an " +
+ s"aggregate")
+ case RecursiveTable(_, _, recursiveTerm, _) =>
+ traversePlanAndCheck(recursiveTerm, true)
Review comment:
my understanding is that in this case we do nothing, so can we avoid
traversing the plan?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]