nk1506 commented on code in PR #10001:
URL: https://github.com/apache/iceberg/pull/10001#discussion_r1530317976


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java:
##########
@@ -169,8 +260,8 @@ default Table newHmsTable(String hmsTableOwner) {
             null,
             Collections.emptyList(),
             Maps.newHashMap(),
-            null,
-            null,
+            properties.getOrDefault(HiveCatalog.VIEW_ORIGINAL_TEXT, null),

Review Comment:
   I think this might not be specific to Hive-View.  This is another field in 
Hive-Table .  IMO, This field either we can ignore for both iceberg-table and 
view or make it optional with properties. 
   Ref: 
https://github.com/apache/hive/blame/df45194268ffb10f9f7aae0ab4e3aec35a7b31d8/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java#L23
 



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -250,29 +264,66 @@ public void renameTable(TableIdentifier from, 
TableIdentifier originalTo) {
             return null;
           });
 
-      LOG.info("Renamed table from {}, to {}", from, to);
+      LOG.info("Renamed {} from {}, to {}", contentType.name(), 
fromIdentifier, to);
 
     } catch (NoSuchObjectException e) {
-      throw new NoSuchTableException("Table does not exist: %s", from);
+      switch (contentType) {
+        case TABLE:
+          throw new NoSuchTableException(
+              "Cannot rename %s to %s. Table does not exist", fromIdentifier, 
to);
+        case VIEW:
+          throw new NoSuchViewException(
+              "Cannot rename %s to %s. View does not exist", fromIdentifier, 
to);
+      }
 
     } catch (InvalidOperationException e) {
       if (e.getMessage() != null
           && e.getMessage().contains(String.format("new table %s already 
exists", to))) {
-        throw new org.apache.iceberg.exceptions.AlreadyExistsException(
-            "Table already exists: %s", to);
+        throwErrorForExistedToContent(fromIdentifier, 
removeCatalogName(toIdentifier));

Review Comment:
   Motivation behind this changes is  
   `ViewCatalogTests` expects error message like `Cannot rename %s to %s. %s 
already exists`. It should explicitly tell the upstream **TO** tableType. 
   
   Also we are making only one call to retrieve TO content. 
   Nevertheless, What do you propose to match the error messages for  
`ViewCatalogTests` ? 



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