[ 
https://issues.apache.org/jira/browse/HIVE-27208?focusedWorklogId=855052&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-855052
 ]

ASF GitHub Bot logged work on HIVE-27208:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Apr/23 12:25
            Start Date: 05/Apr/23 12:25
    Worklog Time Spent: 10m 
      Work Description: 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





Issue Time Tracking
-------------------

    Worklog Id:     (was: 855052)
    Time Spent: 3h 10m  (was: 3h)

> Iceberg: Add support for rename table
> -------------------------------------
>
>                 Key: HIVE-27208
>                 URL: https://issues.apache.org/jira/browse/HIVE-27208
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Ayush Saxena
>            Assignee: Ayush Saxena
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> Add support for renaming iceberg tables.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to