calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [2/9] incubator-calcite git commit: [CALCITE-572] Remove Project.flags
Date Sun, 08 Feb 2015 17:25:01 GMT
[CALCITE-572] Remove Project.flags


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

Branch: refs/heads/master
Commit: 5a6d32a2a0dcc48c25dda51d350b76c9c8bf6d10
Parents: 44650d4
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Authored: Fri Jan 30 16:23:19 2015 -0800
Committer: julianhyde <jhyde@apache.org>
Committed: Fri Feb 6 12:10:34 2015 -0800

----------------------------------------------------------------------
 .../adapter/enumerable/EnumerableProject.java   |  7 ++--
 .../enumerable/EnumerableProjectRule.java       |  4 +-
 .../adapter/enumerable/EnumerableRel.java       |  4 +-
 .../apache/calcite/adapter/jdbc/JdbcRules.java  | 25 ++++--------
 .../apache/calcite/interpreter/Bindables.java   | 12 +++---
 .../org/apache/calcite/plan/RelOptUtil.java     |  9 +---
 .../calcite/plan/SubstitutionVisitor.java       |  2 +-
 .../calcite/prepare/LixToRelTranslator.java     |  3 +-
 .../calcite/prepare/QueryableRelBuilder.java    |  4 +-
 .../org/apache/calcite/rel/core/Project.java    | 43 +-------------------
 .../calcite/rel/logical/LogicalProject.java     | 18 +++-----
 .../rel/rules/ReduceExpressionsRule.java        |  3 +-
 .../calcite/sql2rel/SqlToRelConverter.java      |  9 ++--
 .../org/apache/calcite/tools/PlannerTest.java   |  4 +-
 .../calcite/adapter/mongodb/MongoProject.java   |  6 +--
 .../calcite/adapter/mongodb/MongoRules.java     |  2 +-
 .../calcite/adapter/spark/SparkRules.java       | 20 ++-------
 .../adapter/splunk/SplunkPushDownRule.java      |  2 +-
 18 files changed, 42 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
index f145776..e12f953 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
@@ -33,16 +33,15 @@ public class EnumerableProject extends Project implements EnumerableRel
{
       RelTraitSet traitSet,
       RelNode child,
       List<? extends RexNode> exps,
-      RelDataType rowType,
-      int flags) {
-    super(cluster, traitSet, child, exps, rowType, flags);
+      RelDataType rowType) {
+    super(cluster, traitSet, child, exps, rowType);
     assert getConvention() instanceof EnumerableConvention;
   }
 
   public EnumerableProject copy(RelTraitSet traitSet, RelNode input,
       List<RexNode> exps, RelDataType rowType) {
     return new EnumerableProject(getCluster(), traitSet, input,
-        exps, rowType, flags);
+        exps, rowType);
   }
 
   public Result implement(EnumerableRelImplementor implementor, Prefer pref) {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
index 158365c..b7dcc69 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
@@ -20,7 +20,6 @@ import org.apache.calcite.plan.Convention;
 import org.apache.calcite.plan.RelOptUtil;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.logical.LogicalProject;
 
 /**
@@ -41,8 +40,7 @@ class EnumerableProjectRule extends ConverterRule {
             project.getInput().getTraitSet()
                 .replace(EnumerableConvention.INSTANCE)),
         project.getProjects(),
-        project.getRowType(),
-        Project.Flags.BOXED);
+        project.getRowType());
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java
index 247e4f7..c005faa 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java
@@ -19,7 +19,6 @@ package org.apache.calcite.adapter.enumerable;
 import org.apache.calcite.linq4j.tree.BlockStatement;
 import org.apache.calcite.plan.RelOptCluster;
 import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.core.RelFactories;
 import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rex.RexNode;
@@ -54,8 +53,7 @@ public interface EnumerableRel
                       : SqlValidatorUtil.uniquify(fieldNames,
                           SqlValidatorUtil.F_SUGGESTER));
           return new EnumerableProject(cluster,
-              child.getTraitSet(), child, exprs, rowType,
-              Project.Flags.BOXED);
+              child.getTraitSet(), child, exprs, rowType);
         }
       };
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
index 6bbf1c8..3716730 100644
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
+++ b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
@@ -354,7 +354,7 @@ public class JdbcRules {
 
       return new JdbcCalc(rel.getCluster(), rel.getTraitSet().replace(out),
           convert(calc.getInput(), calc.getTraitSet().replace(out)),
-          calc.getProgram(), Project.Flags.BOXED);
+          calc.getProgram());
     }
   }
 
@@ -364,19 +364,12 @@ public class JdbcRules {
   public static class JdbcCalc extends SingleRel implements JdbcRel {
     private final RexProgram program;
 
-    /**
-     * Values defined in {@link org.apache.calcite.rel.core.Project.Flags}.
-     */
-    protected final int flags;
-
     public JdbcCalc(RelOptCluster cluster,
         RelTraitSet traitSet,
         RelNode child,
-        RexProgram program,
-        int flags) {
+        RexProgram program) {
       super(cluster, traitSet, child);
       assert getConvention() instanceof JdbcConvention;
-      this.flags = flags;
       this.program = program;
       this.rowType = program.getOutputRowType();
     }
@@ -398,8 +391,7 @@ public class JdbcRules {
     }
 
     public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-      return new JdbcCalc(getCluster(), traitSet, sole(inputs), program,
-          flags);
+      return new JdbcCalc(getCluster(), traitSet, sole(inputs), program);
     }
 
     public JdbcImplementor.Result implement(JdbcImplementor implementor) {
@@ -444,8 +436,7 @@ public class JdbcRules {
               project.getInput(),
               project.getInput().getTraitSet().replace(out)),
           project.getProjects(),
-          project.getRowType(),
-          Project.Flags.BOXED);
+          project.getRowType());
     }
   }
 
@@ -459,16 +450,14 @@ public class JdbcRules {
         RelTraitSet traitSet,
         RelNode child,
         List<RexNode> exps,
-        RelDataType rowType,
-        int flags) {
-      super(cluster, traitSet, child, exps, rowType, flags);
+        RelDataType rowType) {
+      super(cluster, traitSet, child, exps, rowType);
       assert getConvention() instanceof JdbcConvention;
     }
 
     @Override public JdbcProject copy(RelTraitSet traitSet, RelNode input,
         List<RexNode> exps, RelDataType rowType) {
-      return new JdbcProject(getCluster(), traitSet, input, exps, rowType,
-          flags);
+      return new JdbcProject(getCluster(), traitSet, input, exps, rowType);
     }
 
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner) {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
index cfe9b37..abb8082 100644
--- a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
+++ b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
@@ -220,8 +220,8 @@ public class Bindables {
               project.getInput().getTraitSet()
                   .replace(BindableConvention.INSTANCE)),
           project.getProjects(),
-          project.getRowType(),
-          Project.Flags.BOXED);
+          project.getRowType()
+      );
     }
   }
 
@@ -229,16 +229,14 @@ public class Bindables {
    * bindable calling convention. */
   public static class BindableProject extends Project implements BindableRel {
     public BindableProject(RelOptCluster cluster, RelTraitSet traitSet,
-        RelNode child, List<? extends RexNode> exps, RelDataType rowType,
-        int flags) {
-      super(cluster, traitSet, child, exps, rowType, flags);
+        RelNode child, List<? extends RexNode> exps, RelDataType rowType) {
+      super(cluster, traitSet, child, exps, rowType);
       assert getConvention() instanceof BindableConvention;
     }
 
     public BindableProject copy(RelTraitSet traitSet, RelNode input,
         List<RexNode> exps, RelDataType rowType) {
-      return new BindableProject(getCluster(), traitSet, input, exps, rowType,
-          flags);
+      return new BindableProject(getCluster(), traitSet, input, exps, rowType);
     }
 
     public Class<Object[]> getElementType() {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
index 72a57f2..88ad2ff 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
@@ -2295,10 +2295,6 @@ public abstract class RelOptUtil {
   public static boolean checkProjAndChildInputs(
       Project project,
       boolean checkNames) {
-    if (!project.isBoxed()) {
-      return false;
-    }
-
     int n = project.getProjects().size();
     RelDataType inputType = project.getInput().getRowType();
     if (inputType.getFieldList().size() != n) {
@@ -2501,7 +2497,7 @@ public abstract class RelOptUtil {
       names.add(field.getName());
     }
     return new LogicalProject(
-        child.getCluster(), child, nodes, names, LogicalProject.Flags.BOXED);
+        child.getCluster(), child, nodes, names);
   }
 
   /** Returns whether relational expression {@code target} occurs within a
@@ -2708,8 +2704,7 @@ public abstract class RelOptUtil {
             : collationList.get(0)),
         child,
         exprs,
-        rowType,
-        Project.Flags.BOXED);
+        rowType);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
index 54fe7b8..de9cb22 100644
--- a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
+++ b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
@@ -593,7 +593,7 @@ public class SubstitutionVisitor {
       return new LogicalProject(node.cluster,
           node.cluster.traitSetOf(RelCollationImpl.EMPTY),
           fromMutable(project.input),
-          project.projects, project.rowType, Project.Flags.BOXED);
+          project.projects, project.rowType);
     case FILTER:
       final MutableFilter filter = (MutableFilter) node;
       return new LogicalFilter(node.cluster, fromMutable(filter.input),

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/prepare/LixToRelTranslator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/prepare/LixToRelTranslator.java b/core/src/main/java/org/apache/calcite/prepare/LixToRelTranslator.java
index 35b43cb..a4de2c0 100644
--- a/core/src/main/java/org/apache/calcite/prepare/LixToRelTranslator.java
+++ b/core/src/main/java/org/apache/calcite/prepare/LixToRelTranslator.java
@@ -92,8 +92,7 @@ class LixToRelTranslator implements RelOptTable.ToRelContext {
             toRex(
                 child,
                 (FunctionExpression) call.expressions.get(0)),
-            null,
-            LogicalProject.Flags.BOXED);
+            null);
 
       case WHERE:
         child = translate(call.targetExpression);

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/prepare/QueryableRelBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/prepare/QueryableRelBuilder.java b/core/src/main/java/org/apache/calcite/prepare/QueryableRelBuilder.java
index c2e4d14..57afc4d 100644
--- a/core/src/main/java/org/apache/calcite/prepare/QueryableRelBuilder.java
+++ b/core/src/main/java/org/apache/calcite/prepare/QueryableRelBuilder.java
@@ -40,7 +40,6 @@ import org.apache.calcite.linq4j.function.Predicate1;
 import org.apache.calcite.linq4j.function.Predicate2;
 import org.apache.calcite.linq4j.tree.FunctionExpression;
 import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.logical.LogicalFilter;
 import org.apache.calcite.rel.logical.LogicalProject;
 import org.apache.calcite.rel.logical.LogicalTableScan;
@@ -515,8 +514,7 @@ class QueryableRelBuilder<T> implements QueryableFactory<T>
{
             translator.cluster,
             child,
             nodes,
-            null,
-            Project.Flags.BOXED));
+            null));
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/rel/core/Project.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/core/Project.java b/core/src/main/java/org/apache/calcite/rel/core/Project.java
index ec3978b..ebd2544 100644
--- a/core/src/main/java/org/apache/calcite/rel/core/Project.java
+++ b/core/src/main/java/org/apache/calcite/rel/core/Project.java
@@ -67,11 +67,6 @@ public abstract class Project extends SingleRel {
 
   protected final ImmutableList<RexNode> exps;
 
-  /**
-   * Values defined in {@link Flags}.
-   */
-  protected int flags;
-
   protected final ImmutableList<RelCollation> collationList;
 
   //~ Constructors -----------------------------------------------------------
@@ -84,21 +79,17 @@ public abstract class Project extends SingleRel {
    * @param input   input relational expression
    * @param exps    List of expressions for the input columns
    * @param rowType output row type
-   * @param flags      Flags; values as in {@link Project.Flags},
-   *                   usually {@link Project.Flags#BOXED}
    */
   protected Project(
       RelOptCluster cluster,
       RelTraitSet traits,
       RelNode input,
       List<? extends RexNode> exps,
-      RelDataType rowType,
-      int flags) {
+      RelDataType rowType) {
     super(cluster, traits, input);
     assert rowType != null;
     this.exps = ImmutableList.copyOf(exps);
     this.rowType = rowType;
-    this.flags = flags;
     final RelCollation collation =
         traits.getTrait(RelCollationTraitDef.INSTANCE);
     this.collationList =
@@ -114,7 +105,7 @@ public abstract class Project extends SingleRel {
   protected Project(RelInput input) {
     this(input.getCluster(), input.getTraitSet(), input.getInput(),
         input.getExpressionList("exprs"),
-        input.getRowType("exprs", "fields"), Flags.BOXED);
+        input.getRowType("exprs", "fields"));
   }
 
   //~ Methods ----------------------------------------------------------------
@@ -144,10 +135,6 @@ public abstract class Project extends SingleRel {
     return collationList;
   }
 
-  public boolean isBoxed() {
-    return (flags & Flags.BOXED) == Flags.BOXED;
-  }
-
   @Override public List<RexNode> getChildExps() {
     return exps;
   }
@@ -179,10 +166,6 @@ public abstract class Project extends SingleRel {
     return Pair.zip(getProjects(), getRowType().getFieldNames());
   }
 
-  public int getFlags() {
-    return flags;
-  }
-
   public boolean isValid(boolean fail) {
     if (!super.isValid(fail)) {
       assert !fail;
@@ -205,12 +188,6 @@ public abstract class Project extends SingleRel {
       assert !fail;
       return false;
     }
-    if (!isBoxed()) {
-      if (exps.size() != 1) {
-        assert !fail;
-        return false;
-      }
-    }
     if (collationList == null) {
       assert !fail;
       return false;
@@ -357,22 +334,6 @@ public abstract class Project extends SingleRel {
 
   //~ Inner Classes ----------------------------------------------------------
 
-  /** A collection of integer constants that describe the kind of project. */
-  public static class Flags {
-    public static final int ANON_FIELDS = 2;
-
-    /**
-     * Whether the resulting row is to be a synthetic class whose fields are
-     * the aliases of the fields. <code>boxed</code> must be true unless
-     * there is only one field: <code>select {dept.deptno} from dept</code>
-     * is boxed, <code>select dept.deptno from dept</code> is not.
-     */
-    public static final int BOXED = 1;
-    public static final int NONE = 0;
-  }
-
-  //~ Inner Classes ----------------------------------------------------------
-
   /**
    * Visitor which walks over a program and checks validity.
    */

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/rel/logical/LogicalProject.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/logical/LogicalProject.java b/core/src/main/java/org/apache/calcite/rel/logical/LogicalProject.java
index 8cc81a5..d60324a 100644
--- a/core/src/main/java/org/apache/calcite/rel/logical/LogicalProject.java
+++ b/core/src/main/java/org/apache/calcite/rel/logical/LogicalProject.java
@@ -44,15 +44,12 @@ public final class LogicalProject extends Project {
    * @param child      input relational expression
    * @param exps       set of expressions for the input columns
    * @param fieldNames aliases of the expressions
-   * @param flags      Flags; values as in {@link Project.Flags},
-   *                   usually {@link Project.Flags#BOXED}
    */
   public LogicalProject(
       RelOptCluster cluster,
       RelNode child,
       List<RexNode> exps,
-      List<String> fieldNames,
-      int flags) {
+      List<String> fieldNames) {
     this(
         cluster,
         cluster.traitSetOf(RelCollationImpl.EMPTY),
@@ -61,8 +58,7 @@ public final class LogicalProject extends Project {
         RexUtil.createStructType(
             cluster.getTypeFactory(),
             exps,
-            fieldNames),
-        flags);
+            fieldNames));
   }
 
   /**
@@ -73,17 +69,14 @@ public final class LogicalProject extends Project {
    * @param child    input relational expression
    * @param exps     List of expressions for the input columns
    * @param rowType  output row type
-   * @param flags      Flags; values as in {@link Project.Flags},
-   *                   usually {@link Project.Flags#BOXED}
    */
   public LogicalProject(
       RelOptCluster cluster,
       RelTraitSet traitSet,
       RelNode child,
       List<? extends RexNode> exps,
-      RelDataType rowType,
-      int flags) {
-    super(cluster, traitSet, child, exps, rowType, flags);
+      RelDataType rowType) {
+    super(cluster, traitSet, child, exps, rowType);
     assert traitSet.containsIfApplicable(Convention.NONE);
   }
 
@@ -98,8 +91,7 @@ public final class LogicalProject extends Project {
 
   @Override public LogicalProject copy(RelTraitSet traitSet, RelNode input,
       List<RexNode> exps, RelDataType rowType) {
-    return new LogicalProject(getCluster(), traitSet, input, exps, rowType,
-        flags);
+    return new LogicalProject(getCluster(), traitSet, input, exps, rowType);
   }
 
   @Override public RelNode accept(RelShuttle shuttle) {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java b/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java
index 16c5e82..d1bcaf2 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java
@@ -200,8 +200,7 @@ public abstract class ReduceExpressionsRule extends RelOptRule {
                     project.getTraitSet(),
                     project.getInput(),
                     expList,
-                    project.getRowType(),
-                    LogicalProject.Flags.BOXED));
+                    project.getRowType()));
 
             // New plan is absolutely better than old plan.
             call.getPlanner().setImportance(project, 0.0);

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
index 7227d86..4723114 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
@@ -678,8 +678,7 @@ public class SqlToRelConverter {
               cluster,
               rel,
               Pair.left(newProjects),
-              Pair.right(newProjects),
-              LogicalProject.Flags.BOXED);
+              Pair.right(newProjects));
 
       bb.root = rel;
       distinctify(bb, false);
@@ -703,8 +702,7 @@ public class SqlToRelConverter {
               cluster,
               rel,
               Pair.left(undoProjects),
-              Pair.right(undoProjects),
-              LogicalProject.Flags.BOXED);
+              Pair.right(undoProjects));
 
       bb.setRoot(
           rel,
@@ -790,8 +788,7 @@ public class SqlToRelConverter {
               bb.root,
               exprs,
               cluster.getTypeFactory().createStructType(
-                  rowType.getFieldList().subList(0, fieldCount)),
-              Project.Flags.BOXED),
+                  rowType.getFieldList().subList(0, fieldCount))),
           false);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/tools/PlannerTest.java b/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
index 23fe783..4342c19 100644
--- a/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
+++ b/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
@@ -38,7 +38,6 @@ import org.apache.calcite.plan.RelTraitSet;
 import org.apache.calcite.rel.RelCollationTraitDef;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.core.TableScan;
 import org.apache.calcite.rel.metadata.RelMetadataQuery;
 import org.apache.calcite.rel.rules.FilterMergeRule;
@@ -790,8 +789,7 @@ public class PlannerTest {
           convert(project.getInput(),
               project.getInput().getTraitSet().replace(getOutConvention())),
           project.getProjects(),
-          project.getRowType(),
-          Project.Flags.BOXED);
+          project.getRowType());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoProject.java
----------------------------------------------------------------------
diff --git a/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoProject.java b/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoProject.java
index 9bbf512..c2f5a52 100644
--- a/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoProject.java
+++ b/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoProject.java
@@ -37,8 +37,8 @@ import java.util.List;
  */
 public class MongoProject extends Project implements MongoRel {
   public MongoProject(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode child, List<RexNode> exps, RelDataType rowType, int flags) {
-    super(cluster, traitSet, child, exps, rowType, flags);
+      RelNode child, List<RexNode> exps, RelDataType rowType) {
+    super(cluster, traitSet, child, exps, rowType);
     assert getConvention() == MongoRel.CONVENTION;
     assert getConvention() == child.getConvention();
   }
@@ -46,7 +46,7 @@ public class MongoProject extends Project implements MongoRel {
   @Override public Project copy(RelTraitSet traitSet, RelNode input,
       List<RexNode> exps, RelDataType rowType) {
     return new MongoProject(getCluster(), traitSet, input, exps,
-        rowType, flags);
+        rowType);
   }
 
   @Override public RelOptCost computeSelfCost(RelOptPlanner planner) {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoRules.java
----------------------------------------------------------------------
diff --git a/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoRules.java b/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoRules.java
index 2b2f250..f67e0ee 100644
--- a/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoRules.java
+++ b/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoRules.java
@@ -261,7 +261,7 @@ public class MongoRules {
       final RelTraitSet traitSet = project.getTraitSet().replace(out);
       return new MongoProject(project.getCluster(), traitSet,
           convert(project.getInput(), traitSet), project.getProjects(),
-          project.getRowType(), LogicalProject.Flags.BOXED);
+          project.getRowType());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
----------------------------------------------------------------------
diff --git a/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java b/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
index 24ebc99..6ba9b7e 100644
--- a/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
+++ b/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
@@ -41,7 +41,6 @@ import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.RelWriter;
 import org.apache.calcite.rel.SingleRel;
 import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.core.Values;
 import org.apache.calcite.rel.logical.LogicalCalc;
 import org.apache.calcite.rel.logical.LogicalFilter;
@@ -240,8 +239,7 @@ public abstract class SparkRules {
           rel.getTraitSet().replace(SparkRel.CONVENTION),
           convert(calc.getInput(),
               calc.getInput().getTraitSet().replace(SparkRel.CONVENTION)),
-          program,
-          Project.Flags.BOXED);
+          program);
     }
   }
 
@@ -250,20 +248,13 @@ public abstract class SparkRules {
   public static class SparkCalc extends SingleRel implements SparkRel {
     private final RexProgram program;
 
-    /**
-     * Values defined in {@link org.apache.calcite.rel.core.Project.Flags}.
-     */
-    protected int flags;
-
     public SparkCalc(RelOptCluster cluster,
         RelTraitSet traitSet,
         RelNode child,
-        RexProgram program,
-        int flags) {
+        RexProgram program) {
       super(cluster, traitSet, child);
       assert getConvention() == SparkRel.CONVENTION;
       assert !program.containsAggs();
-      this.flags = flags;
       this.program = program;
       this.rowType = program.getOutputRowType();
     }
@@ -290,12 +281,7 @@ public abstract class SparkRules {
           getCluster(),
           traitSet,
           sole(inputs),
-          program,
-          getFlags());
-    }
-
-    public int getFlags() {
-      return flags;
+          program);
     }
 
     public Result implementSpark(Implementor implementor) {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/5a6d32a2/splunk/src/main/java/org/apache/calcite/adapter/splunk/SplunkPushDownRule.java
----------------------------------------------------------------------
diff --git a/splunk/src/main/java/org/apache/calcite/adapter/splunk/SplunkPushDownRule.java
b/splunk/src/main/java/org/apache/calcite/adapter/splunk/SplunkPushDownRule.java
index 49bb859..2976f87 100644
--- a/splunk/src/main/java/org/apache/calcite/adapter/splunk/SplunkPushDownRule.java
+++ b/splunk/src/main/java/org/apache/calcite/adapter/splunk/SplunkPushDownRule.java
@@ -285,7 +285,7 @@ public class SplunkPushDownRule
             proj.getCollationList().isEmpty()
                 ? RelCollationImpl.EMPTY
                 : proj.getCollationList().get(0)),
-        rel, proj.getProjects(), proj.getRowType(), proj.getFlags());
+        rel, proj.getProjects(), proj.getRowType());
   }
 
   // TODO: use StringBuilder instead of String


Mime
View raw message