tomtongue commented on code in PR #8931:
URL: https://github.com/apache/iceberg/pull/8931#discussion_r1381164050


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/MigrateTableSparkAction.java:
##########
@@ -108,6 +109,23 @@ public MigrateTableSparkAction backupTableName(String 
tableName) {
     return this;
   }
 
+  @Override
+  public MigrateTableSparkAction destCatalogName(String catalogName) {
+    CatalogManager catalogManager = spark().sessionState().catalogManager();
+
+    CatalogPlugin catalogPlugin;
+    if (catalogManager.isCatalogRegistered(catalogName)) {
+      catalogPlugin = catalogManager.catalog(catalogName);
+    } else {
+      LOG.warn(
+          "{} doesn't exist in SparkSession. " + "Fallback to current 
SparkSession catalog.",
+          catalogName);
+      catalogPlugin = catalogManager.currentCatalog();
+    }
+    this.destCatalog = checkDestinationCatalog(catalogPlugin);

Review Comment:
   @singhpk234 thanks for checking my comments.
   
   In this part, the `renameTable` checks if the source table is Iceberg or 
not. However, for the `migrate` procedure, the source table must be 
`spark_catalog` (for example, if the `glue_catalog` is specified, it fails as 
described above).
   So in the `migrate` query, `getSessionCatalog().renameTable(from, to);` is 
called, and the answer for your question below is YES.
   
   > so that we are not using the GlueCatalog implementation (of iceberg) which 
supports rename and are falling back to the V2SessionCatalog.renameTable which 
is using GlueMetaStoreClient and doesn't support rename ?
   
   As you're mentioning, the `V2SessionCatalog.rename` falls back to 
GlueMetastoreClient that doesn't support table rename. And the query always 
fails.



-- 
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: [email protected]

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