nrg4878 commented on a change in pull request #2450:
URL: https://github.com/apache/hive/pull/2450#discussion_r666401686



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -5934,6 +5936,12 @@ private void alter_table_core(String catName, String 
dbname, String name, Table
       catName = MetaStoreUtils.getDefaultCatalog(conf);
     }
 
+    // HIVE-25282: Drop/Alter table in REMOTE db should fail
+    Database db = get_database_core(catName, dbname);

Review comment:
       per the comment above, can you wrap this code in a try/catch and 
re-throw the NoSuchObjectException as an InvalidOperationException? Ideally 
this should throw back a NoSuchObjectException, but I am concerned about 
backward compatibilty with older clients.

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -5882,7 +5884,7 @@ public String getVersion() throws TException {
   @Override
   public void alter_table(final String dbname, final String name,
                           final Table newTable)
-      throws InvalidOperationException, MetaException {
+      throws InvalidOperationException, MetaException, NoSuchObjectException {

Review comment:
       so I am assuming the get_database_core() call now throws a 
NoSuchObjectException that we now have to account for.
   I realize the current code is a bit inconsistent when it comes to exception 
handling. so for drop_table(), if the table does not exist, we throw a 
NoSuchObjectException. But for alter_table() if the table does not exist, we 
catch the NoSuchObjectException and rethrow it as an InvalidOperationException. 
   Ideally they should be consistent.
   
   But I am a bit concerned about throwing a new exception from HMS. It might 
be backwards-incompatible with the current code. Could you instead catch this 
and re-throw as InvalidOperationException as well. 
   

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -5892,7 +5894,7 @@ public void alter_table(final String dbname, final String 
name,
   @Override
   public void alter_table_with_cascade(final String dbname, final String name,
                                        final Table newTable, final boolean 
cascade)
-      throws InvalidOperationException, MetaException {
+      throws InvalidOperationException, MetaException, NoSuchObjectException {
     EnvironmentContext envContext = null;

Review comment:
       same as above comment




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