TuroczyX commented on code in PR #4185:
URL: https://github.com/apache/hive/pull/4185#discussion_r1158448164


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java:
##########
@@ -222,6 +222,19 @@ public static Table registerTable(Configuration conf, 
Properties props, String m
     return new HadoopTables(conf).create(schema, spec, map, location);
   }
 
+  public static void renameTable(Configuration conf, Properties props, 
TableIdentifier to) {
+    String catalogName = props.getProperty(InputFormatConfig.CATALOG_NAME);
+
+    Optional<Catalog> catalog = loadCatalog(conf, catalogName);
+    if (catalog.isPresent()) {
+      String name = props.getProperty(NAME);
+      Preconditions.checkNotNull(name, "Table identifier not set");
+      catalog.get().renameTable(TableIdentifier.parse(name), to);
+    } else {
+      throw new RuntimeException("Rename from " + props.getProperty(NAME) + " 
to " + to + "failed");

Review Comment:
   Also could be "Table rename from _Cars_ to _Cats_ has been failed". I would 
put the Rename Table into the exception message. It would be much cleaner for 
the reader which operation failed. I know it it is not a big deal just bit 
cleaner imho



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