cloud-fan commented on code in PR #50082:
URL: https://github.com/apache/spark/pull/50082#discussion_r1971351719


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveDDLCommandStringTypes.scala:
##########
@@ -48,12 +48,18 @@ object ResolveDDLCommandStringTypes extends 
Rule[LogicalPlan] {
       case createView: CreateView if createView.collation.isDefined =>
         StringType(createView.collation.get)
       case alterTable: AlterTableCommand if alterTable.table.resolved =>
-        val collation = Option(alterTable
-          .table.asInstanceOf[ResolvedTable]
-          .table.properties.get(TableCatalog.PROP_COLLATION))
-        if (collation.isDefined) {
-          StringType(collation.get)
+        if (alterTable.table.isInstanceOf[ResolvedTable]) {
+          val collation = Option(alterTable
+            .table.asInstanceOf[ResolvedTable]
+            .table.properties.get(TableCatalog.PROP_COLLATION))
+          if (collation.isDefined) {
+            StringType(collation.get)
+          } else {
+            StringType(defaultCollation)
+          }
         } else {
+          // Object level collation is not supported for materialized views 
(instance of
+          // ResolvedPersistentView) for now.

Review Comment:
   ```suggestion
             // As a safeguard, use the default collation for unknown cases.
   ```



-- 
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