nastra commented on code in PR #9834:
URL: https://github.com/apache/iceberg/pull/9834#discussion_r1507614885


##########
spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckViews.scala:
##########
@@ -63,4 +72,29 @@ object CheckViews extends (LogicalPlan => Unit) {
       }
     }
   }
+
+  private def checkCyclicViewReference(
+    viewIdent: Seq[String],
+    plan: LogicalPlan): Unit = {
+    plan match {
+      case sub@SubqueryAlias(_, Project(_, _)) =>
+        val ident: Seq[String] = sub.identifier.qualifier :+ 
sub.identifier.name
+        if (ident == viewIdent) {
+          throw new AnalysisException(String.format("Recursive cycle in view 
detected: %s", viewIdent.asIdentifier))

Review Comment:
   We could also consider including the actual cycle in the error msg. Spark's 
error msg for V1 views is `[RECURSIVE_VIEW] Recursive view 
`spark_catalog`.`default`.`view_one754453` detected (cycle: 
`spark_catalog`.`default`.`view_one754453` -> 
`spark_catalog`.`default`.`view_one754453`).`



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to