drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject drill git commit: DRILL-3156: Fix Calcite trace by registering RelMetadataProvider with HepPlanner used for window function planning.
Date Tue, 14 Jul 2015 01:15:47 GMT
Repository: drill
Updated Branches:
  refs/heads/master 7edddd65e -> 09252c9aa


DRILL-3156: Fix Calcite trace by registering RelMetadataProvider with HepPlanner used for
window function planning.


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/09252c9a
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/09252c9a
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/09252c9a

Branch: refs/heads/master
Commit: 09252c9aac95f2079db7582a57af4e88ce7aa114
Parents: 7edddd6
Author: Jinfeng Ni <jni@apache.org>
Authored: Tue Jun 30 15:56:12 2015 -0700
Committer: Jinfeng Ni <jni@apache.org>
Committed: Mon Jul 13 13:41:10 2015 -0700

----------------------------------------------------------------------
 .../exec/planner/sql/handlers/DefaultSqlHandler.java  | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/09252c9a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
index e96f63e..a53c242 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
@@ -39,6 +39,7 @@ import org.apache.calcite.rel.core.TableScan;
 import org.apache.calcite.rel.logical.LogicalValues;
 import org.apache.calcite.rel.metadata.CachingRelMetadataProvider;
 import org.apache.calcite.rel.metadata.ChainedRelMetadataProvider;
+import org.apache.calcite.rel.metadata.DefaultRelMetadataProvider;
 import org.apache.calcite.rel.metadata.RelMetadataProvider;
 import org.apache.calcite.rel.rules.JoinToMultiJoinRule;
 import org.apache.calcite.rel.rules.LoptOptimizeJoinRule;
@@ -446,10 +447,21 @@ public class DefaultSqlHandler extends AbstractSqlHandler {
   }
 
   private RelNode convertToRel(SqlNode node) throws RelConversionException {
-    RelNode convertedNode = planner.convert(node);
+    final RelNode convertedNode = planner.convert(node);
+
+    final RelMetadataProvider provider = convertedNode.getCluster().getMetadataProvider();
+
+    // Register RelMetadataProvider with HepPlanner.
+    final List<RelMetadataProvider> list = Lists.newArrayList(provider);
+    hepPlanner.registerMetadataProviders(list);
+    final RelMetadataProvider cachingMetaDataProvider = new CachingRelMetadataProvider(ChainedRelMetadataProvider.of(list),
hepPlanner);
+    convertedNode.accept(new MetaDataProviderModifier(cachingMetaDataProvider));
+
+    // HepPlanner is specifically used for Window Function planning only.
     hepPlanner.setRoot(convertedNode);
     RelNode rel = hepPlanner.findBestExp();
 
+    rel.accept(new MetaDataProviderModifier(provider));
     return rel;
   }
 


Mime
View raw message