brkyvz commented on a change in pull request #25735: [SPARK-29030][SQL] 
Simplify lookupV2Relation
URL: https://github.com/apache/spark/pull/25735#discussion_r323469202
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ##########
 @@ -970,25 +966,24 @@ class Analyzer(
         tableName: Seq[String],
         changes: Seq[TableChange]): Option[AlterTable] = {
       lookupV2Relation(tableName) match {
-        case scala.Left((v2Catalog, ident, tableOpt)) =>
+        case (Some(table), Some((catalog, ident))) =>
           Some(AlterTable(
-            v2Catalog.asTableCatalog,
+            catalog,
             ident,
-            
tableOpt.map(DataSourceV2Relation.create).getOrElse(UnresolvedRelation(tableName)),
-            changes
-          ))
-        case scala.Right(tableOpt) =>
-          tableOpt.map { table =>
-            AlterTable(
-              sessionCatalog.asTableCatalog,
-              Identifier.of(tableName.init.toArray, tableName.last),
-              DataSourceV2Relation.create(table),
-              changes
-            )
-          }
+            DataSourceV2Relation.create(table),
+            changes))
+        case (Some(table), None) =>
+          Some(AlterTable(
+            sessionCatalog.asTableCatalog, // table being resolved means this 
exists
 
 Review comment:
   maybe use `catalogManager.v2SessionCatalog` to be consistent with 
`lookupV2Relation`?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to