[
https://issues.apache.org/jira/browse/HIVE-20274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16562696#comment-16562696
]
Gopal V commented on HIVE-20274:
--------------------------------
That's not the best way to use the cache, but that's the right way to replace a
concurrent hashmap with the cache impl 1:1.
.asMap().putIfAbsent() is what the LoadingCache does once it has built the
entry, but in this case multiple threads might construct their own entries &
only one would get cached.
Replacing it with .get(key, callable) would be the atomic way to do this, but
keeping the change as a drop-in replacement means I don't need to review for
callable exception handling.
> HiveServer2 ObjectInspectorFactory leaks for Struct and List object inspectors
> ------------------------------------------------------------------------------
>
> Key: HIVE-20274
> URL: https://issues.apache.org/jira/browse/HIVE-20274
> Project: Hive
> Issue Type: Bug
> Components: HiveServer2
> Affects Versions: 3.0.0, 4.0.0
> Reporter: Gopal V
> Assignee: Prasanth Jayachandran
> Priority: Major
> Attachments: HIVE-20274.1.patch
>
>
> Fix in HIVE-19860 needs to be applied to
> {code}
> static ConcurrentHashMap<ObjectInspector, StandardListObjectInspector>
> cachedStandardListObjectInspector = new
> ConcurrentHashMap<ObjectInspector, StandardListObjectInspector>();
> ...
> static ConcurrentHashMap<ArrayList<List<?>>, StandardStructObjectInspector>
> cachedStandardStructObjectInspector =
> new ConcurrentHashMap<ArrayList<List<?>>,
> StandardStructObjectInspector>();
> ...
> static ConcurrentHashMap<ArrayList<Object>, ColumnarStructObjectInspector>
> cachedColumnarStructObjectInspector =
> new ConcurrentHashMap<ArrayList<Object>,
> ColumnarStructObjectInspector>();
> {code}
> And possibly for
> {code}
> static ConcurrentHashMap<Type, ObjectInspector> objectInspectorCache = new
> ConcurrentHashMap<Type, ObjectInspector>();
> ...
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)