Spark: Fail on recursive cycle in view#9834
Conversation
| 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)) |
There was a problem hiding this 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_one754453detected (cycle:spark_catalog.default.view_one754453->spark_catalog.default.view_one754453).
There was a problem hiding this comment.
Do you mean it includes the whole cycle path? If so I think that would be useful for someone trying to debug why this error is happening. Basically as we recurse on the cycle check, we can keep track of the path of identifiers seen by appending the identifier that's being visited currently.
There was a problem hiding this comment.
@amogh-jahagirdar I've added the cycle to the error msg in the last commit. Can you take another look please?
5ad411e to
ca48b37
Compare
ca48b37 to
173e857
Compare
|
CI failure is known and related to #10038 |
amogh-jahagirdar
left a comment
There was a problem hiding this comment.
Thanks for fixing this, this looks good to me!
No description provided.