belugabehr commented on a change in pull request #2312:
URL: https://github.com/apache/hive/pull/2312#discussion_r639710520



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
##########
@@ -338,15 +330,17 @@ public boolean waitForValidStatus() {
   }
 
   // Allow lookup by query string
-  private final Map<String, Set<CacheEntry>> queryMap = new HashMap<String, 
Set<CacheEntry>>();
+  @GuardedBy("cacheLock")
+  private final Multimap<String, CacheEntry> queryMap = HashMultimap.create();
 
   // LRU. Could also implement LRU as a doubly linked list if CacheEntry keeps 
its node.
   // Use synchronized map since even read actions cause the lru to get updated.
-  private final Map<CacheEntry, CacheEntry> lru = Collections.synchronizedMap(
-      new LinkedHashMap<CacheEntry, CacheEntry>(INITIAL_LRU_SIZE, 
LRU_LOAD_FACTOR, true));
+  private final Set<CacheEntry> lru =
+      Collections.synchronizedSet(Collections.newSetFromMap(new 
LinkedHashMap<>(16, 0.75f, true)));

Review comment:
       Use `Set` instead of Map with the same key/value




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

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