You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/10/28 18:24:49 UTC

[GitHub] [calcite] hsyuan commented on a change in pull request #1533: [CALCITE-3446] Make RelMetadataQuery extensible

hsyuan commented on a change in pull request #1533: [CALCITE-3446] Make RelMetadataQuery extensible
URL: https://github.com/apache/calcite/pull/1533#discussion_r339417872
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/plan/RelOptCluster.java
 ##########
 @@ -135,23 +140,41 @@ public RelMetadataProvider getMetadataProvider() {
   public void setMetadataProvider(RelMetadataProvider metadataProvider) {
     this.metadataProvider = metadataProvider;
     this.metadataFactory = new MetadataFactoryImpl(metadataProvider);
+    // Wrap the metadata provider as a JaninoRelMetadataProvider
+    // and set it to the ThreadLocal,
+    // JaninoRelMetadataProvider is required by the RelMetadataQuery.
+    AbstractRelMetadataQuery.THREAD_PROVIDERS
+        .set(JaninoRelMetadataProvider.of(metadataProvider));
   }
 
   public MetadataFactory getMetadataFactory() {
     return metadataFactory;
   }
 
+  /**
+   * Set up the customized {@link RelMetadataQuery} instance that to use during rule planning.
+   *
+   * <p>Caution that the {@code mqSupplier} should return
+   * a fresh new {@link RelMetadataQuery} instance because the instance would be
+   * cached in this cluster, and we may invalidate and re-generate it
+   * for each {@link RelOptRuleCall} circle.
 
 Review comment:
   circle  -> cycle

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services