hsyuan commented on a change in pull request #1281: [CALCITE-3149] RelDataType
CACHE in RelDataTypeFactoryImpl can't be garbage collected
URL: https://github.com/apache/calcite/pull/1281#discussion_r298439516
##########
File path:
core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
##########
@@ -50,19 +52,20 @@
//~ Instance fields --------------------------------------------------------
/**
- * Global cache. Uses soft values to allow GC.
+ * Global cache for Key to RelDataType. Uses soft values to allow GC.
*/
- private static final LoadingCache<Object, RelDataType> CACHE =
+ private static final LoadingCache<Key, RelDataType> KEY2TYPE_CACHE =
CacheBuilder.newBuilder()
.softValues()
.build(CacheLoader.from(RelDataTypeFactoryImpl::keyToType));
- private static RelDataType keyToType(@Nonnull Object k) {
- if (k instanceof RelDataType) {
- return (RelDataType) k;
- }
- @SuppressWarnings("unchecked")
- final Key key = (Key) k;
+ /**
+ * Global cache for RelDataType.
+ */
+ private static final Interner<RelDataType> DATATYPE_CACHE =
Review comment:
There is. But I don't think it is worth the effort, and the test will be
time and memory consuming to reproduce the issue.
----------------------------------------------------------------
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]
With regards,
Apache Git Services