calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [32/50] [abbrv] calcite git commit: [CALCITE-977] Make the constant expression Executor configurable in FrameworkConfig (Jason Altekruse)
Date Sat, 23 Jan 2016 00:30:50 GMT
[CALCITE-977] Make the constant expression Executor configurable in FrameworkConfig (Jason
Altekruse)

Close apache/calcite#182


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

Branch: refs/remotes/julianhyde/master
Commit: 5323d8d48baa2d7bc8dea8b03bc0bda93563e0f9
Parents: e15f89e
Author: Jason Altekruse <altekrusejason@gmail.com>
Authored: Fri Apr 10 13:07:35 2015 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Tue Jan 12 13:47:17 2016 -0800

----------------------------------------------------------------------
 .../org/apache/calcite/plan/RelOptPlanner.java   |  1 +
 .../org/apache/calcite/prepare/PlannerImpl.java  |  3 +++
 .../apache/calcite/tools/FrameworkConfig.java    |  6 ++++++
 .../org/apache/calcite/tools/Frameworks.java     | 19 +++++++++++++++++--
 4 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/5323d8d4/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java b/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
index 9b5e22a..bad9402 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
@@ -318,6 +318,7 @@ public interface RelOptPlanner {
   /** Sets the object that can execute scalar expressions. */
   void setExecutor(Executor executor);
 
+  /** Returns the executor used to evaluate constant expressions. */
   Executor getExecutor();
 
   /** Called when a relational expression is copied to a similar expression. */

http://git-wip-us.apache.org/repos/asf/calcite/blob/5323d8d4/core/src/main/java/org/apache/calcite/prepare/PlannerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/prepare/PlannerImpl.java b/core/src/main/java/org/apache/calcite/prepare/PlannerImpl.java
index 18d9746..fa6ea30 100644
--- a/core/src/main/java/org/apache/calcite/prepare/PlannerImpl.java
+++ b/core/src/main/java/org/apache/calcite/prepare/PlannerImpl.java
@@ -72,6 +72,7 @@ public class PlannerImpl implements Planner {
   private SchemaPlus defaultSchema;
   private JavaTypeFactory typeFactory;
   private RelOptPlanner planner;
+  private RelOptPlanner.Executor executor;
 
   // set in STATE_4_VALIDATE
   private CalciteSqlValidator validator;
@@ -91,6 +92,7 @@ public class PlannerImpl implements Planner {
     this.state = State.STATE_0_CLOSED;
     this.traitDefs = config.getTraitDefs();
     this.convertletTable = config.getConvertletTable();
+    this.executor = config.getExecutor();
     reset();
   }
 
@@ -135,6 +137,7 @@ public class PlannerImpl implements Planner {
             Util.discard(rootSchema); // use our own defaultSchema
             typeFactory = (JavaTypeFactory) cluster.getTypeFactory();
             planner = cluster.getPlanner();
+            planner.setExecutor(executor);
             return null;
           }
         },

http://git-wip-us.apache.org/repos/asf/calcite/blob/5323d8d4/core/src/main/java/org/apache/calcite/tools/FrameworkConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/tools/FrameworkConfig.java b/core/src/main/java/org/apache/calcite/tools/FrameworkConfig.java
index 6301321..319c216 100644
--- a/core/src/main/java/org/apache/calcite/tools/FrameworkConfig.java
+++ b/core/src/main/java/org/apache/calcite/tools/FrameworkConfig.java
@@ -18,6 +18,7 @@ package org.apache.calcite.tools;
 
 import org.apache.calcite.plan.Context;
 import org.apache.calcite.plan.RelOptCostFactory;
+import org.apache.calcite.plan.RelOptPlanner;
 import org.apache.calcite.plan.RelTraitDef;
 import org.apache.calcite.rel.type.RelDataTypeSystem;
 import org.apache.calcite.schema.SchemaPlus;
@@ -46,6 +47,11 @@ public interface FrameworkConfig {
   SchemaPlus getDefaultSchema();
 
   /**
+   * Returns the executor used to evaluate constant expressions.
+   */
+  RelOptPlanner.Executor getExecutor();
+
+  /**
    * Returns a list of one or more programs used during the course of query
    * evaluation.
    *

http://git-wip-us.apache.org/repos/asf/calcite/blob/5323d8d4/core/src/main/java/org/apache/calcite/tools/Frameworks.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/tools/Frameworks.java b/core/src/main/java/org/apache/calcite/tools/Frameworks.java
index dffac61..a4e43fc 100644
--- a/core/src/main/java/org/apache/calcite/tools/Frameworks.java
+++ b/core/src/main/java/org/apache/calcite/tools/Frameworks.java
@@ -21,6 +21,7 @@ import org.apache.calcite.jdbc.CalciteSchema;
 import org.apache.calcite.plan.Context;
 import org.apache.calcite.plan.RelOptCluster;
 import org.apache.calcite.plan.RelOptCostFactory;
+import org.apache.calcite.plan.RelOptPlanner;
 import org.apache.calcite.plan.RelOptSchema;
 import org.apache.calcite.plan.RelTraitDef;
 import org.apache.calcite.prepare.CalcitePrepareImpl;
@@ -179,6 +180,7 @@ public class Frameworks {
     private SqlParser.Config parserConfig =
         SqlParser.Config.DEFAULT;
     private SchemaPlus defaultSchema;
+    private RelOptPlanner.Executor executor;
     private RelOptCostFactory costFactory;
     private RelDataTypeSystem typeSystem = RelDataTypeSystem.DEFAULT;
 
@@ -187,7 +189,7 @@ public class Frameworks {
     public FrameworkConfig build() {
       return new StdFrameworkConfig(context, convertletTable, operatorTable,
           programs, traitDefs, parserConfig, defaultSchema, costFactory,
-          typeSystem);
+          typeSystem, executor);
     }
 
     public ConfigBuilder context(Context c) {
@@ -195,6 +197,12 @@ public class Frameworks {
       return this;
     }
 
+    public ConfigBuilder executor(RelOptPlanner.Executor executor) {
+      Preconditions.checkNotNull(executor);
+      this.executor = executor;
+      return this;
+    }
+
     public ConfigBuilder convertletTable(
         SqlRexConvertletTable convertletTable) {
       this.convertletTable = Preconditions.checkNotNull(convertletTable);
@@ -273,6 +281,7 @@ public class Frameworks {
     private final SchemaPlus defaultSchema;
     private final RelOptCostFactory costFactory;
     private final RelDataTypeSystem typeSystem;
+    private final RelOptPlanner.Executor executor;
 
     public StdFrameworkConfig(Context context,
         SqlRexConvertletTable convertletTable,
@@ -282,7 +291,8 @@ public class Frameworks {
         SqlParser.Config parserConfig,
         SchemaPlus defaultSchema,
         RelOptCostFactory costFactory,
-        RelDataTypeSystem typeSystem) {
+        RelDataTypeSystem typeSystem,
+        RelOptPlanner.Executor executor) {
       this.context = context;
       this.convertletTable = convertletTable;
       this.operatorTable = operatorTable;
@@ -292,6 +302,7 @@ public class Frameworks {
       this.defaultSchema = defaultSchema;
       this.costFactory = costFactory;
       this.typeSystem = typeSystem;
+      this.executor = executor;
     }
 
     public SqlParser.Config getParserConfig() {
@@ -302,6 +313,10 @@ public class Frameworks {
       return defaultSchema;
     }
 
+    public RelOptPlanner.Executor getExecutor() {
+      return executor;
+    }
+
     public ImmutableList<Program> getPrograms() {
       return programs;
     }


Mime
View raw message