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

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

                Author: ASF GitHub Bot
            Created on: 09/Dec/21 17:53
            Start Date: 09/Dec/21 17:53
    Worklog Time Spent: 10m 
      Work Description: scarlin-cloudera commented on a change in pull request 
#2841:
URL: https://github.com/apache/hive/pull/2841#discussion_r766025515



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
##########
@@ -2206,31 +2201,21 @@ public String getNewSparkSessionId() {
     return getSessionId() + "_" + 
Long.toString(this.sparkSessionId.getAndIncrement());
   }
 
-  /**
-   * Can be called when we start compilation of a query.
-   * @param queryId the unique identifier of the query
-   */
-  public void startScope(String queryId) {
-    Map<Object, Object> existingVal = cache.put(queryId, new HashMap<>());
-    Preconditions.checkState(existingVal == null);
-  }
-
-  /**
-   * Can be called when we end compilation of a query.
-   * @param queryId the unique identifier of the query
-   */
-  public void endScope(String queryId) {
-    Map<Object, Object> existingVal = cache.remove(queryId);
-    Preconditions.checkState(existingVal != null);
-  }
-
   /**
    * Retrieves the query cache for the given query.
    * @param queryId the unique identifier of the query
    * @return the cache for the query
    */
   public Map<Object, Object> getQueryCache(String queryId) {
-    return cache.get(queryId);
+    QueryState qs = getQueryState(queryId);
+    if (qs == null) {
+      return null;
+    }
+
+    if (qs == null) {

Review comment:
       Duplicated code




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


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

    Worklog Id:     (was: 693443)
    Time Spent: 20m  (was: 10m)

> Extend query-level HMS cache lifetime beyond analysis stage
> -----------------------------------------------------------
>
>                 Key: HIVE-25768
>                 URL: https://issues.apache.org/jira/browse/HIVE-25768
>             Project: Hive
>          Issue Type: Improvement
>          Components: HiveServer2
>            Reporter: John Sherman
>            Assignee: John Sherman
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> HIVE-24176 added a HMS response cache to improve compilation times when 
> metadata is requested multiple times. The cache gets destroyed after 
> analysis. If we extend the lifetime of the cache beyond analysis it could be 
> used to reduce HMS communication for other areas such as various exec hooks 
> that inspect the metadata for a query.
> The impetus that motivated this change is specifically the Atlas hook which 
> generates lineage information and makes HMS calls. These calls to HMS can add 
> latency to query results.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to