ljfgem commented on code in PR #35636:
URL: https://github.com/apache/spark/pull/35636#discussion_r953238606
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -447,6 +454,74 @@ class Analyzer(override val catalogManager: CatalogManager)
}
}
+ /**
+ * Substitute persisted views in parsed plans with parsed view sql text.
+ */
+ case class ViewSubstitution(sqlParser: ParserInterface) extends
Rule[LogicalPlan] {
+
+ def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsUp {
+ case u @ UnresolvedRelation(nameParts, _, _) if
v1SessionCatalog.isTempView(nameParts) =>
+ u
+ case u @ UnresolvedRelation(
+ parts @ NonSessionCatalogAndIdentifier(catalog, ident), _, _) if
!isSQLOnFile(parts) =>
Review Comment:
Could we avoid limiting it to the non-session catalog? There might be the
use case that `spark_catalog` is set to be custom table & view catalog, like
[CoralSparkViewCatalog](https://github.com/linkedin/coral/pull/297/files#diff-e0aa76aa937fc5e2d279def7c494f4e33d2ab35cdc30b5822f1e8746b2a21500)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]