imback82 commented on a change in pull request #32542:
URL: https://github.com/apache/spark/pull/32542#discussion_r632322384



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -3516,15 +3508,16 @@ class Analyzer(override val catalogManager: 
CatalogManager)
   /** Rule to mostly resolve, normalize and rewrite column names based on case 
sensitivity. */
   object ResolveAlterTableChanges extends Rule[LogicalPlan] {
     def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsUp {
-      case a @ AlterTable(_, _, t: NamedRelation, changes) if t.resolved =>
+      case a: AlterTable if a.table.resolved =>
         // 'colsToAdd' keeps track of new columns being added. It stores a 
mapping from a
         // normalized parent name of fields to field names that belong to the 
parent.
         // For example, if we add columns "a.b.c", "a.b.d", and "a.c", 
'colsToAdd' will become
         // Map(Seq("a", "b") -> Seq("c", "d"), Seq("a") -> Seq("c")).
         val colsToAdd = mutable.Map.empty[Seq[String], Seq[String]]
-        val schema = t.schema
-        val normalizedChanges = changes.flatMap {
+        val schema = a.table.schema
+        val normalizedChanges = a.changes.flatMap {
           case add: AddColumn =>
+            CatalogV2Util.failNullType(add.dataType)

Review comment:
       This is moved from `ResolveSessionCatalog.scala`.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to