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


##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HivePrivilegeObject.java:
##########
@@ -110,12 +113,20 @@ private int compare(Collection<String> o1, 
Collection<String> o2) {
   }
 
   /**
-   * Try to get thread local configuration from HMSHandler, otherwise create a 
new one.
-   * @return configuration
+   * @return the given catalog name if not blank, otherwise the current 
catalog of the session in HS2,
+   * or the default catalog from the HMSHandler configuration (or a new 
metastore configuration).
    */
-  public static Configuration getConf() {
-    return HMSHandlerContext.getConfiguration()
-        .orElse(new Configuration());
+  private String getCatalogOrDefault(String catName) {
+    if (StringUtils.isNotBlank(catName)) {
+      return catName;
+    } else if (SessionState.get() != null) {
+      // HS2
+      return SessionState.get().getCurrentCatalog();
+    }

Review Comment:
   In SessionState, it resolves the catalog from the session conf when 
currentCatalog is null, some other places use the same way as well, such as, 
   
https://github.com/apache/hive/blob/b828b70e67f47d23aa67a7c9cdb873e98ae1bc16/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveTableName.java#L140,
 used in drop partition, acquire locks, replication, and some analyzers.
   
   
   



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