calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [47/50] [abbrv] calcite git commit: [CALCITE-1057] Add RelMetadataProvider parameter to standard planner Programs
Date Thu, 21 Jan 2016 22:39:24 GMT
[CALCITE-1057] Add RelMetadataProvider parameter to standard planner Programs


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

Branch: refs/heads/branch-release
Commit: af77ec861989c50229c55be1889efcb0031cfd32
Parents: cecef9d
Author: maryannxue <wei.xue@intel.com>
Authored: Thu Jan 14 14:17:18 2016 -0800
Committer: Julian Hyde <jhyde@apache.org>
Committed: Thu Jan 14 14:17:18 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/calcite/tools/Programs.java | 27 +++++++++++++++-----
 1 file changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/af77ec86/core/src/main/java/org/apache/calcite/tools/Programs.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/tools/Programs.java b/core/src/main/java/org/apache/calcite/tools/Programs.java
index 472563e..a52387d 100644
--- a/core/src/main/java/org/apache/calcite/tools/Programs.java
+++ b/core/src/main/java/org/apache/calcite/tools/Programs.java
@@ -102,14 +102,11 @@ public class Programs {
 
   /** Program that converts filters and projects to {@link Calc}s. */
   public static final Program CALC_PROGRAM =
-      hep(CALC_RULES, true, new DefaultRelMetadataProvider());
+      calc(new DefaultRelMetadataProvider());
 
   /** Program that expands sub-queries. */
   public static final Program SUB_QUERY_PROGRAM =
-      hep(
-          ImmutableList.of((RelOptRule) SubQueryRemoveRule.FILTER,
-              SubQueryRemoveRule.PROJECT,
-              SubQueryRemoveRule.JOIN), true, new DefaultRelMetadataProvider());
+      subquery(new DefaultRelMetadataProvider());
 
   public static final ImmutableSet<RelOptRule> RULE_SET =
       ImmutableSet.of(
@@ -260,6 +257,17 @@ public class Programs {
     };
   }
 
+  public static Program calc(RelMetadataProvider metadataProvider) {
+    return hep(CALC_RULES, true, metadataProvider);
+  }
+
+  public static Program subquery(RelMetadataProvider metadataProvider) {
+    return hep(
+        ImmutableList.of((RelOptRule) SubQueryRemoveRule.FILTER,
+            SubQueryRemoveRule.PROJECT,
+            SubQueryRemoveRule.JOIN), true, metadataProvider);
+  }
+
   public static Program getProgram() {
     return new Program() {
       public RelNode run(RelOptPlanner planner, RelNode rel,
@@ -271,6 +279,11 @@ public class Programs {
 
   /** Returns the standard program used by Prepare. */
   public static Program standard() {
+    return standard(new DefaultRelMetadataProvider());
+  }
+
+  /** Returns the standard program with user metadata provider. */
+  public static Program standard(RelMetadataProvider metadataProvider) {
 
     final Program program1 =
         new Program() {
@@ -290,14 +303,14 @@ public class Programs {
           }
         };
 
-    return sequence(SUB_QUERY_PROGRAM,
+    return sequence(subquery(metadataProvider),
         new DecorrelateProgram(),
         new TrimFieldsProgram(),
         program1,
 
         // Second planner pass to do physical "tweaks". This the first time that
         // EnumerableCalcRel is introduced.
-        CALC_PROGRAM);
+        calc(metadataProvider));
   }
 
   /** Program backed by a {@link RuleSet}. */


Mime
View raw message