dengzhhu653 commented on code in PR #4726:
URL: https://github.com/apache/hive/pull/4726#discussion_r1364801515


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -4129,6 +4129,8 @@ public List<Partition> getPartitions(Table tbl) throws 
HiveException {
           GetPartitionsPsWithAuthResponse res = 
getMSC().listPartitionsWithAuthInfoRequest(req);
           tParts = res.getPartitions();
 
+        } catch (NoSuchObjectException nsoe) {
+          return Lists.newArrayList();

Review Comment:
   The call `getMSC().listPartitionsWithAuthInfoRequest` here will goes to 
`ObjectStore. getPartitionsWithAuth`. The `getPartitionsWithAuth` doesn't check 
the table exits or not, it will return an empty list to the caller.
   `
   I merge the ObjectStore `getPartitionsWithAuth` and 
`listPartitionsPsWithAuth`, the two methods almost do the same thing except the 
`listPartitionsPsWithAuth` gets the partitions with partition values.
   
   `listPartitionsPsWithAuth` does the check, and throws the exception in case 
the table is missing:
   
https://github.com/apache/hive/blob/84583f6fa1c779908852c49510c03495534f2e03/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L3916-L3918
   
   `listPartitionsPsWithAuth` will use direct sql to get the partitions in this 
case, this will get some performance gain compared to `getPartitionsWithAuth`.
   



-- 
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: gitbox-unsubscr...@hive.apache.org

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


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

Reply via email to