stefankandic commented on code in PR #50082:
URL: https://github.com/apache/spark/pull/50082#discussion_r1971339848


##########
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]) {

Review Comment:
   Would it make sense to refactor this in a more idiomatic Scala way?
   
   ```code
   alterTable.table match {
     case resolvedTbl: ResolvedTable =>
       val collation = resolvedTbl.table.properties.getOrDefault(
         TableCatalog.PROP_COLLATION, defaultCollation)
       StringType(collation)
   
     case _ =>
       StringType(defaultCollation)
   }
   ```



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