-
Notifications
You must be signed in to change notification settings - Fork 3k
Spark: Fail on recursive cycle in view #9834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this, this looks good to me!
No description provided.