srielau commented on code in PR #46267:
URL: https://github.com/apache/spark/pull/46267#discussion_r1595698980


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala:
##########
@@ -620,3 +621,66 @@ object CollationCheck extends (LogicalPlan => Unit) {
   private def isCollationExpression(expression: Expression): Boolean =
     expression.isInstanceOf[Collation] || expression.isInstanceOf[Collate]
 }
+
+
+/**
+ * This rule checks for references to views WITH SCHEMA [TYPE] EVOLUTION and 
synchronizes the
+ * catalog if evolution was detected.
+ * It does so by walking the resolved plan looking for View operators for 
persisted views.
+ */
+object SyncViewsCheck extends (LogicalPlan => Unit) {
+    def apply(plan: LogicalPlan): Unit = {
+    plan.foreach {
+      case View(metaData, isTempView, viewQuery)
+        if (metaData.viewSchemaMode != SchemaUnsupported && !isTempView) =>
+        val viewSchemaMode = metaData.viewSchemaMode
+        if (viewSchemaMode == SchemaTypeEvolution || viewSchemaMode == 
SchemaEvolution) {
+          val viewFields = metaData.schema.fields
+          val planFields = plan.schema.fields

Review Comment:
   I've replaced plan with viewQuery.
   I think these are the same though, right? view() just passes the schema 
through



-- 
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: reviews-unsubscr...@spark.apache.org

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


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

Reply via email to