asdfgh19 commented on code in PR #3169:
URL: https://github.com/apache/calcite/pull/3169#discussion_r1174349726


##########
core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewRule.java:
##########
@@ -92,6 +95,16 @@
 public abstract class MaterializedViewRule<C extends 
MaterializedViewRule.Config>
     extends RelRule<C> {
 
+  /**
+   * Weak-key cache of RelMetadataQuery to MaterializationMetadata. The idea 
is that when
+   * the RelMetadataQuery goes away, so does the cache entry.
+   */
+  private final LoadingCache<RelMetadataQuery, MaterializationMetadata>
+      materializationMetadataCache =
+      CacheBuilder.newBuilder()

Review Comment:
   > Should we set some parameters?
   > 
   > For example: initialCapacity, maximumSize, refreshAfterWrite, ...
   
   Through Gc Roots analysis, I found that weakKeys cannot take effect. Even if 
I delete MaterializationMetadata#RelMetadataQuery, there is still a strong 
reference pointing to RelMetadataQuery in 
MaterializationMetadata#RelOptMaterialization#tableRel, so we should really add 
two parameters, maximumSize and expireAfterAccess, to 
materializationMetadataCache. Thanks for your suggestion and review!



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

Reply via email to