amogh-jahagirdar commented on code in PR #11165:
URL: https://github.com/apache/iceberg/pull/11165#discussion_r1770604602


##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java:
##########
@@ -415,15 +415,19 @@ public void renameTable(TableIdentifier from, 
TableIdentifier to) {
             .tableType(fromTable.tableType())
             .parameters(fromTable.parameters())
             .storageDescriptor(fromTable.storageDescriptor());
-
-    glue.createTable(
-        CreateTableRequest.builder()
-            .catalogId(awsProperties.glueCatalogId())
-            .databaseName(toTableDbName)
-            .tableInput(tableInputBuilder.name(toTableName).build())
-            .build());
-    LOG.info("created rename destination table {}", to);
-
+    try {
+        glue.createTable(
+            CreateTableRequest.builder()
+                .catalogId(awsProperties.glueCatalogId())
+                .databaseName(toTableDbName)
+                .tableInput(tableInputBuilder.name(toTableName).build())
+                .build());
+        LOG.info("created rename destination table {}", to);
+    } catch (software.amazon.awssdk.services.glue.model.AlreadyExistsException 
e) {
+    // Catch AWS Glue exception and rethrow it as Iceberg's 
AlreadyExistsException
+    throw new org.apache.iceberg.exceptions.AlreadyExistsException("Table 
already exists: " + toTableName, e);

Review Comment:
   Can we use the fully qualified `AlreadyExistsException` for glue and then 
just use the normal class name the Iceberg `AlreadyExistsException`. That 
aligns with what's done in the other parts of the code and is a bit more 
readable imo.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to