calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [1/3] calcite git commit: Cosmetic changes, and deprecate some methods
Date Sun, 20 Nov 2016 22:17:48 GMT
Repository: calcite
Updated Branches:
  refs/heads/master 3f92157d5 -> a4bdab682


Cosmetic changes, and deprecate some methods


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

Branch: refs/heads/master
Commit: 3ccfb9c0622c0b12f7b74403dabb80badd2b3bfb
Parents: 3f92157
Author: Julian Hyde <jhyde@apache.org>
Authored: Thu Nov 3 20:52:08 2016 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Sun Nov 20 12:59:20 2016 -0800

----------------------------------------------------------------------
 .../calcite/plan/RelOptPredicateList.java       |  14 +-
 .../org/apache/calcite/plan/RelOptUtil.java     | 183 +++----------------
 .../calcite/rel/metadata/RelMdPredicates.java   |   2 +-
 .../FilterRemoveIsNotDistinctFromRule.java      |   6 +-
 .../rel/rules/JoinExtractFilterRule.java        |   8 +-
 .../rel/rules/SemiJoinFilterTransposeRule.java  |   8 +-
 .../org/apache/calcite/rex/RexExecutorImpl.java |   5 +-
 .../apache/calcite/sql2rel/RelDecorrelator.java |   6 +-
 .../apache/calcite/sql2rel/SqlRexContext.java   |   2 +-
 .../calcite/sql2rel/SqlToRelConverter.java      |  95 +++++-----
 .../sql2rel/StandardConvertletTable.java        |  25 ++-
 .../calcite/test/MaterializationTest.java       |  30 +--
 .../calcite/test/SqlToRelConverterTest.java     |  20 +-
 13 files changed, 143 insertions(+), 261 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/plan/RelOptPredicateList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptPredicateList.java b/core/src/main/java/org/apache/calcite/plan/RelOptPredicateList.java
index 1acc86f..d163905 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptPredicateList.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptPredicateList.java
@@ -149,10 +149,16 @@ public class RelOptPredicateList {
 
   public RelOptPredicateList union(RexBuilder rexBuilder,
       RelOptPredicateList list) {
-    return RelOptPredicateList.of(rexBuilder,
-        concat(pulledUpPredicates, list.pulledUpPredicates),
-        concat(leftInferredPredicates, list.leftInferredPredicates),
-        concat(rightInferredPredicates, list.rightInferredPredicates));
+    if (this == EMPTY) {
+      return list;
+    } else if (list == EMPTY) {
+      return this;
+    } else {
+      return RelOptPredicateList.of(rexBuilder,
+          concat(pulledUpPredicates, list.pulledUpPredicates),
+          concat(leftInferredPredicates, list.leftInferredPredicates),
+          concat(rightInferredPredicates, list.rightInferredPredicates));
+    }
   }
 
   /** Concatenates two immutable lists, avoiding a copy it possible. */

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/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 16c9b05..23147c2 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
@@ -202,7 +202,7 @@ public abstract class RelOptUtil {
    * Returns a set of tables used by this expression or its children
    */
   public static Set<RelOptTable> findTables(RelNode rel) {
-    return new LinkedHashSet<RelOptTable>(findAllTables(rel));
+    return new LinkedHashSet<>(findAllTables(rel));
   }
 
   /**
@@ -232,10 +232,7 @@ public abstract class RelOptUtil {
     return visitor.variables;
   }
 
-  /**
-   * Returns a set of distinct variables set by <code>rel0</code> and used by
-   * <code>rel1</code>.
-   */
+  @Deprecated // to be removed before 2.0
   public static List<CorrelationId> getVariablesSetAndUsed(RelNode rel0,
       RelNode rel1) {
     Set<CorrelationId> set = getVariablesSet(rel0);
@@ -415,25 +412,7 @@ public abstract class RelOptUtil {
     return mapping;
   }
 
-  /**
-   * Creates a plan suitable for use in <code>EXISTS</code> or <code>IN</code>
-   * statements.
-   *
-   * <p>See {@link org.apache.calcite.sql2rel.SqlToRelConverter#convertExists}
-   *
-   * <p>Note: this implementation of createExistsPlan is only called from
-   * net.sf.farrago.fennel.rel. The last two arguments do not apply to those
-   * invocations and can be removed from the method.
-   *
-   * @param cluster    Cluster
-   * @param seekRel    A query rel, for example the resulting rel from 'select *
-   *                   from emp' or 'values (1,2,3)' or '('Foo', 34)'.
-   * @param conditions May be null
-   * @param extraExpr  Column expression to add. "TRUE" for EXISTS and IN
-   * @param extraName  Name of expression to add.
-   * @return relational expression which outer joins a boolean condition
-   * column
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode createExistsPlan(
       RelOptCluster cluster,
       RelNode seekRel,
@@ -448,8 +427,9 @@ public abstract class RelOptUtil {
           RexUtil.composeConjunction(
               cluster.getRexBuilder(), conditions, true);
 
-      ret = createFilter(ret, conditionExp,
-          RelFactories.DEFAULT_FILTER_FACTORY);
+      final RelFactories.FilterFactory factory =
+          RelFactories.DEFAULT_FILTER_FACTORY;
+      ret = factory.createFilter(ret, conditionExp);
     }
 
     if (extraExpr != null) {
@@ -560,15 +540,7 @@ public abstract class RelOptUtil {
     }
   }
 
-  /**
-   * Creates a LogicalProject which accomplishes a rename.
-   *
-   * @param outputType a row type descriptor whose field names the generated
-   *                   LogicalProject must match
-   * @param rel        the rel whose output is to be renamed; rel.getRowType()
-   *                   must be the same as outputType except for field names
-   * @return generated relational expression
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode createRenameRel(
       RelDataType outputType,
       RelNode rel) {
@@ -597,28 +569,14 @@ public abstract class RelOptUtil {
     return createProject(rel, Pair.left(renames), Pair.right(renames));
   }
 
-  /**
-   * Creates a relational expression which filters according to a given
-   * condition, returning the same fields as its input, using the default
-   * filter factory.
-   *
-   * @param child     Child relational expression
-   * @param condition Condition
-   * @return Relational expression
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode createFilter(RelNode child, RexNode condition) {
-    return createFilter(child, condition, RelFactories.DEFAULT_FILTER_FACTORY);
+    final RelFactories.FilterFactory factory =
+        RelFactories.DEFAULT_FILTER_FACTORY;
+    return factory.createFilter(child, condition);
   }
 
-  /**
-   * Creates a relational expression which filters according to a given
-   * condition, returning the same fields as its input.
-   *
-   * @param child     Child relational expression
-   * @param condition Condition
-   * @param filterFactory Filter factory
-   * @return Relational expression
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode createFilter(RelNode child, RexNode condition,
       RelFactories.FilterFactory filterFactory) {
     return filterFactory.createFilter(child, condition);
@@ -644,18 +602,11 @@ public abstract class RelOptUtil {
     if (condition == null) {
       return child;
     } else {
-      return createFilter(child, condition, filterFactory);
+      return filterFactory.createFilter(child, condition);
     }
   }
 
-  /**
-   * Creates a filter which will remove rows containing NULL values.
-   *
-   * @param rel           the rel to be filtered
-   * @param fieldOrdinals array of 0-based field ordinals to filter, or null
-   *                      for all fields
-   * @return filtered rel
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode createNullFilter(
       RelNode rel,
       Integer[] fieldOrdinals) {
@@ -699,7 +650,9 @@ public abstract class RelOptUtil {
       return rel;
     }
 
-    return createFilter(rel, condition, RelFactories.DEFAULT_FILTER_FACTORY);
+    final RelFactories.FilterFactory factory =
+        RelFactories.DEFAULT_FILTER_FACTORY;
+    return factory.createFilter(rel, condition);
   }
 
   /**
@@ -792,6 +745,7 @@ public abstract class RelOptUtil {
         ImmutableList.<AggregateCall>of());
   }
 
+  @Deprecated // to be removed before 2.0
   public static boolean analyzeSimpleEquiJoin(
       LogicalJoin join,
       int[] joinFieldOrdinals) {
@@ -884,14 +838,7 @@ public abstract class RelOptUtil {
         left.getCluster().getRexBuilder(), nonEquiList, false);
   }
 
-  /**
-   * Returns whether a join condition is an "equi-join" condition.
-   *
-   * @param left      Left input of join
-   * @param right     Right input of join
-   * @param condition Condition
-   * @return Whether condition is equi-join
-   */
+  @Deprecated // to be removed before 2.0
   public static boolean isEqui(
       RelNode left,
       RelNode right,
@@ -997,6 +944,7 @@ public abstract class RelOptUtil {
         inputs.get(0).getCluster().getRexBuilder(), nonEquiList, false);
   }
 
+  @Deprecated // to be removed before 2.0
   public static RexNode splitCorrelatedFilterCondition(
       LogicalFilter filter,
       List<RexInputRef> joinKeys,
@@ -1579,25 +1527,7 @@ public abstract class RelOptUtil {
     return call;
   }
 
-  /**
-   * Adding projection to the inputs of a join to produce the required join
-   * keys.
-   *
-   * @param inputRels      inputs to a join
-   * @param leftJoinKeys   expressions for LHS of join key
-   * @param rightJoinKeys  expressions for RHS of join key
-   * @param systemColCount number of system columns, usually zero. These
-   *                       columns are projected at the leading edge of the
-   *                       output row.
-   * @param leftKeys       on return this contains the join key positions from
-   *                       the new project rel on the LHS.
-   * @param rightKeys      on return this contains the join key positions from
-   *                       the new project rel on the RHS.
-   * @param outputProj     on return this contains the positions of the original
-   *                       join output in the (to be formed by caller)
-   *                       LhxJoinRel. Caller needs to be responsible for adding
-   *                       projection on the new join output.
-   */
+  @Deprecated // to be removed before 2.0
   public static void projectJoinInputs(
       RelNode[] inputRels,
       List<RexNode> leftJoinKeys,
@@ -1696,15 +1626,7 @@ public abstract class RelOptUtil {
     inputRels[1] = rightRel;
   }
 
-  /**
-   * Creates a projection on top of a join, if the desired projection is a
-   * subset of the join columns
-   *
-   * @param outputProj desired projection; if null, return original join node
-   * @param joinRel    the join node
-   * @return projected join node or the original join if projection is
-   * unnecessary
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode createProjectJoinRel(
       List<Integer> outputProj,
       RelNode joinRel) {
@@ -2015,17 +1937,7 @@ public abstract class RelOptUtil {
     return sw.toString();
   }
 
-  /**
-   * Renames a relational expression to make its field names the same as
-   * another row type. If the row type is already identical, or if the row
-   * type is too different (the fields are different in number or type) does
-   * nothing.
-   *
-   * @param rel            Relational expression
-   * @param desiredRowType Desired row type (including desired field names)
-   * @return Renamed relational expression, or the original expression if
-   * there is nothing to do or nothing we <em>can</em> do.
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode renameIfNecessary(
       RelNode rel,
       RelDataType desiredRowType) {
@@ -2500,18 +2412,7 @@ public abstract class RelOptUtil {
     }
   }
 
-  /**
-   * Determines if a projection and its input reference identical input
-   * references.
-   *
-   * @param project    projection being examined
-   * @param checkNames if true, also compare that the names of the project
-   *                   fields and its child fields
-   * @return if checkNames is false, true is returned if the project and its
-   * child reference the same input references, regardless of the names of the
-   * project and child fields; if checkNames is true, then true is returned if
-   * the input references are the same but the field names are different
-   */
+  @Deprecated // to be removed before 2.0
   public static boolean checkProjAndChildInputs(
       Project project,
       boolean checkNames) {
@@ -2888,7 +2789,7 @@ public abstract class RelOptUtil {
       List<String> fieldNames,
       boolean optimize) {
     return createProject(child, exprs, fieldNames, optimize,
-            RelFactories.LOGICAL_BUILDER.create(child.getCluster(), null));
+        RelFactories.LOGICAL_BUILDER.create(child.getCluster(), null));
   }
 
   /**
@@ -2933,14 +2834,7 @@ public abstract class RelOptUtil {
     return relBuilder.build();
   }
 
-  /**
-   * Returns a relational expression which has the same fields as the
-   * underlying expression, but the fields have different names.
-   *
-   * @param rel        Relational expression
-   * @param fieldNames Field names
-   * @return Renamed relational expression
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode createRename(
       RelNode rel,
       List<String> fieldNames) {
@@ -3080,30 +2974,7 @@ public abstract class RelOptUtil {
         RelBuilder.proto(factory).create(child.getCluster(), null));
   }
 
-  /**
-   * Creates a relational expression which projects the output fields of a
-   * relational expression according to a partial mapping.
-   *
-   * <p>A partial mapping is weaker than a permutation: every target has one
-   * source, but a source may have 0, 1 or more than one targets. Usually the
-   * result will have fewer fields than the source, unless some source fields
-   * are projected multiple times.
-   *
-   * <p>This method could optimize the result as {@link #permute} does, but
-   * does not at present.
-   *
-   * @param rel        Relational expression
-   * @param mapping Mapping from source fields to target fields. The mapping
-   * type must obey the constraints
-   * {@link org.apache.calcite.util.mapping.MappingType#isMandatorySource()}
-   * and
-   * {@link org.apache.calcite.util.mapping.MappingType#isSingleSource()},
-   * as does
-   * {@link org.apache.calcite.util.mapping.MappingType#INVERSE_FUNCTION}.
-   * @param fieldNames Field names; if null, or if a particular entry is null,
-   *                   the name of the permuted field is used
-   * @return relational expression which projects a subset of the input fields
-   */
+  @Deprecated // to be removed before 2.0
   public static RelNode projectMapping(
       RelNode rel,
       Mapping mapping,

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
index ba0d6d6..0a4e89c 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
@@ -229,7 +229,7 @@ public class RelMdPredicates
     final RelOptPredicateList inputInfo = mq.getPulledUpPredicates(input);
 
     return Util.first(inputInfo, RelOptPredicateList.EMPTY)
-        .union(filter.getCluster().getRexBuilder(),
+        .union(rexBuilder,
             RelOptPredicateList.of(rexBuilder,
                 RelOptUtil.conjunctions(filter.getCondition())));
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/rel/rules/FilterRemoveIsNotDistinctFromRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/FilterRemoveIsNotDistinctFromRule.java b/core/src/main/java/org/apache/calcite/rel/rules/FilterRemoveIsNotDistinctFromRule.java
index 85fe7e2..989be27 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/FilterRemoveIsNotDistinctFromRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/FilterRemoveIsNotDistinctFromRule.java
@@ -20,6 +20,7 @@ import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
 import org.apache.calcite.plan.RelOptUtil;
 import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.RelFactories;
 import org.apache.calcite.rel.logical.LogicalFilter;
 import org.apache.calcite.rex.RexBuilder;
 import org.apache.calcite.rex.RexCall;
@@ -69,9 +70,10 @@ public final class FilterRemoveIsNotDistinctFromRule extends RelOptRule {
         new RemoveIsNotDistinctFromRexShuttle(
             oldFilter.getCluster().getRexBuilder());
 
+    final RelFactories.FilterFactory factory =
+        RelFactories.DEFAULT_FILTER_FACTORY;
     RelNode newFilterRel =
-        RelOptUtil.createFilter(
-            oldFilter.getInput(),
+        factory.createFilter(oldFilter.getInput(),
             oldFilterCond.accept(rewriteShuttle));
 
     call.transformTo(newFilterRel);

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/rel/rules/JoinExtractFilterRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/JoinExtractFilterRule.java b/core/src/main/java/org/apache/calcite/rel/rules/JoinExtractFilterRule.java
index 724b318..8d3f665 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/JoinExtractFilterRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/JoinExtractFilterRule.java
@@ -18,10 +18,10 @@ package org.apache.calcite.rel.rules;
 
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.calcite.plan.RelOptUtil;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.core.Join;
 import org.apache.calcite.rel.core.JoinRelType;
+import org.apache.calcite.rel.core.RelFactories;
 import org.apache.calcite.rel.logical.LogicalJoin;
 
 /**
@@ -84,10 +84,10 @@ public final class JoinExtractFilterRule extends RelOptRule {
             join.getJoinType(),
             join.isSemiJoinDone());
 
+    final RelFactories.FilterFactory factory =
+        RelFactories.DEFAULT_FILTER_FACTORY;
     RelNode filterRel =
-        RelOptUtil.createFilter(
-            cartesianJoinRel,
-            join.getCondition());
+        factory.createFilter(cartesianJoinRel, join.getCondition());
 
     call.transformTo(filterRel);
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinFilterTransposeRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinFilterTransposeRule.java b/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinFilterTransposeRule.java
index 0a6b26e..486e43c 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinFilterTransposeRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinFilterTransposeRule.java
@@ -18,8 +18,8 @@ package org.apache.calcite.rel.rules;
 
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.calcite.plan.RelOptUtil;
 import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.RelFactories;
 import org.apache.calcite.rel.core.SemiJoin;
 import org.apache.calcite.rel.logical.LogicalFilter;
 
@@ -64,10 +64,10 @@ public class SemiJoinFilterTransposeRule extends RelOptRule {
             semiJoin.getLeftKeys(),
             semiJoin.getRightKeys());
 
+    final RelFactories.FilterFactory factory =
+        RelFactories.DEFAULT_FILTER_FACTORY;
     RelNode newFilter =
-        RelOptUtil.createFilter(
-            newSemiJoin,
-            filter.getCondition());
+        factory.createFilter(newSemiJoin, filter.getCondition());
 
     call.transformTo(newFilter);
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java b/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java
index 1e43611..6cd6f7e 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java
@@ -104,8 +104,9 @@ public class RexExecutorImpl implements RelOptPlanner.Executor {
    */
   public RexExecutable getExecutable(RexBuilder rexBuilder, List<RexNode> exps,
       RelDataType rowType) {
-    final InputGetter getter =
-        new DataContextInputGetter(rowType, rexBuilder.getTypeFactory());
+    final JavaTypeFactoryImpl typeFactory =
+        new JavaTypeFactoryImpl(rexBuilder.getTypeFactory().getTypeSystem());
+    final InputGetter getter = new DataContextInputGetter(rowType, typeFactory);
     final String code = compile(rexBuilder, exps, getter, rowType);
     return new RexExecutable(code, "generated Rex code");
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
index 1fb6e4f..a705543 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
@@ -880,10 +880,10 @@ public class RelDecorrelator implements ReflectiveVisitor {
 
     // Replace the filter expression to reference output of the join
     // Map filter to the new filter over join
+    final RelFactories.FilterFactory factory =
+        RelFactories.DEFAULT_FILTER_FACTORY;
     RelNode newFilter =
-        RelOptUtil.createFilter(
-            frame.r,
-            decorrelateExpr(rel.getCondition()));
+        factory.createFilter(frame.r, decorrelateExpr(rel.getCondition()));
 
     // Filter does not change the input ordering.
     // Filter rel does not permute the input.

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/sql2rel/SqlRexContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/SqlRexContext.java b/core/src/main/java/org/apache/calcite/sql2rel/SqlRexContext.java
index 15ce0ee..2d7575c 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/SqlRexContext.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/SqlRexContext.java
@@ -71,7 +71,7 @@ public interface SqlRexContext {
    * @param call IN or EXISTS expression
    * @return Expression used to access current row of sub-query
    */
-  RexRangeRef getSubqueryExpr(SqlCall call);
+  RexRangeRef getSubQueryExpr(SqlCall call);
 
   /**
    * Returns the type factory.

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/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 f079cb5..1adec8a 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
@@ -168,7 +168,6 @@ import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 
 import org.slf4j.Logger;
 
@@ -182,6 +181,7 @@ import java.util.Collections;
 import java.util.Deque;
 import java.util.EnumSet;
 import java.util.HashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -951,7 +951,7 @@ public class SqlToRelConverter {
       return;
     }
     SqlNode newWhere = pushDownNotForIn(where);
-    replaceSubqueries(bb, newWhere, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
+    replaceSubQueries(bb, newWhere, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
     final RexNode convertedWhere = bb.convertExpression(newWhere);
 
     // only allocate filter if the condition is not TRUE
@@ -959,7 +959,9 @@ public class SqlToRelConverter {
       return;
     }
 
-    final RelNode filter = RelOptUtil.createFilter(bb.root, convertedWhere);
+    final RelFactories.FilterFactory factory =
+        RelFactories.DEFAULT_FILTER_FACTORY;
+    final RelNode filter = factory.createFilter(bb.root, convertedWhere);
     final RelNode r;
     final CorrelationUse p = getCorrelationUse(bb, filter);
     if (p != null) {
@@ -974,17 +976,17 @@ public class SqlToRelConverter {
     bb.setRoot(r, false);
   }
 
-  private void replaceSubqueries(
+  private void replaceSubQueries(
       final Blackboard bb,
       final SqlNode expr,
       RelOptUtil.Logic logic) {
     findSubqueries(bb, expr, logic, false);
-    for (SubQuery node : bb.subqueryList) {
-      substituteSubquery(bb, node);
+    for (SubQuery node : bb.subQueryList) {
+      substituteSubQuery(bb, node);
     }
   }
 
-  private void substituteSubquery(Blackboard bb, SubQuery subQuery) {
+  private void substituteSubQuery(Blackboard bb, SubQuery subQuery) {
     final RexNode expr = subQuery.expr;
     if (expr != null) {
       // Already done.
@@ -1027,18 +1029,18 @@ public class SqlToRelConverter {
         leftKeys = ImmutableList.of(bb.convertExpression(leftKeyNode));
       }
 
-      final boolean isNotIn = ((SqlInOperator) call.getOperator()).isNotIn();
+      final boolean notIn = ((SqlInOperator) call.getOperator()).isNotIn();
       if (query instanceof SqlNodeList) {
         SqlNodeList valueList = (SqlNodeList) query;
         if (!containsNullLiteral(valueList)
-            && valueList.size() < getInSubqueryThreshold()) {
+            && valueList.size() < config.getInSubqueryThreshold()) {
           // We're under the threshold, so convert to OR.
           subQuery.expr =
               convertInToOr(
                   bb,
                   leftKeys,
                   valueList,
-                  isNotIn);
+                  notIn);
           return;
         }
 
@@ -1049,7 +1051,7 @@ public class SqlToRelConverter {
 
       // Project out the search columns from the left side
 
-      //  Q1:
+      // Q1:
       // "select from emp where emp.deptno in (select col1 from T)"
       //
       // is converted to
@@ -1070,7 +1072,7 @@ public class SqlToRelConverter {
       //         and q.indicator <> TRUE"
       //
       final boolean outerJoin = bb.subqueryNeedsOuterJoin
-          || isNotIn
+          || notIn
           || subQuery.logic == RelOptUtil.Logic.TRUE_FALSE_UNKNOWN;
       final RelDataType targetRowType =
           SqlTypeUtil.promoteToRowType(typeFactory,
@@ -1104,7 +1106,7 @@ public class SqlToRelConverter {
               outerJoin ? JoinRelType.LEFT : JoinRelType.INNER, leftKeys);
 
       subQuery.expr = translateIn(subQuery, bb.root, rex);
-      if (isNotIn) {
+      if (notIn) {
         subQuery.expr =
             rexBuilder.makeCall(SqlStdOperatorTable.NOT, subQuery.expr);
       }
@@ -1696,7 +1698,7 @@ public class SqlToRelConverter {
     case SCALAR_QUERY:
       if (!registerOnlyScalarSubqueries
           || (kind == SqlKind.SCALAR_QUERY)) {
-        bb.registerSubquery(node, RelOptUtil.Logic.TRUE_FALSE);
+        bb.registerSubQuery(node, RelOptUtil.Logic.TRUE_FALSE);
       }
       return;
     case IN:
@@ -1751,7 +1753,7 @@ public class SqlToRelConverter {
           && !bb.subqueryNeedsOuterJoin) {
         logic = RelOptUtil.Logic.TRUE;
       }
-      bb.registerSubquery(node, logic);
+      bb.registerSubQuery(node, logic);
     }
   }
 
@@ -2042,7 +2044,7 @@ public class SqlToRelConverter {
       final List<SqlNode> nodes = call.getOperandList();
       final SqlUnnestOperator operator = (SqlUnnestOperator) call.getOperator();
       for (SqlNode node : nodes) {
-        replaceSubqueries(bb, node, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
+        replaceSubQueries(bb, node, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
       }
       final List<RexNode> exprs = new ArrayList<>();
       final List<String> fieldNames = new ArrayList<>();
@@ -2089,7 +2091,7 @@ public class SqlToRelConverter {
       datasetStack.pop();
       return;
     }
-    replaceSubqueries(bb, call, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
+    replaceSubQueries(bb, call, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
 
     // Expand table macro if possible. It's more efficient than
     // LogicalTableFunctionScan.
@@ -2165,7 +2167,9 @@ public class SqlToRelConverter {
       LogicalCorrelate corr = LogicalCorrelate.create(leftRel, p.r,
           p.id, p.requiredColumns, SemiJoinType.of(joinType));
       if (!joinCond.isAlwaysTrue()) {
-        return RelOptUtil.createFilter(corr, joinCond);
+        final RelFactories.FilterFactory factory =
+            RelFactories.DEFAULT_FILTER_FACTORY;
+        return factory.createFilter(corr, joinCond);
       }
       return corr;
     }
@@ -2348,7 +2352,7 @@ public class SqlToRelConverter {
       return rexBuilder.makeLiteral(true);
     }
     bb.setRoot(ImmutableList.of(leftRel, rightRel));
-    replaceSubqueries(bb, condition, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
+    replaceSubQueries(bb, condition, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
     switch (conditionType) {
     case ON:
       bb.setRoot(ImmutableList.of(leftRel, rightRel));
@@ -2463,14 +2467,15 @@ public class SqlToRelConverter {
 
     // first replace the subqueries inside the aggregates
     // because they will provide input rows to the aggregates.
-    replaceSubqueries(bb, aggregateFinder.list, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
+    replaceSubQueries(bb, aggregateFinder.list,
+        RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
 
     // If group-by clause is missing, pretend that it has zero elements.
     if (groupList == null) {
       groupList = SqlNodeList.EMPTY;
     }
 
-    replaceSubqueries(bb, groupList, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
+    replaceSubQueries(bb, groupList, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
 
     // register the group exprs
 
@@ -2589,7 +2594,7 @@ public class SqlToRelConverter {
       // the replaced expressions
       if (having != null) {
         SqlNode newHaving = pushDownNotForIn(having);
-        replaceSubqueries(bb, newHaving, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
+        replaceSubQueries(bb, newHaving, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
         havingExpr = bb.convertExpression(newHaving);
         if (havingExpr.isAlwaysTrue()) {
           havingExpr = null;
@@ -2600,7 +2605,7 @@ public class SqlToRelConverter {
       // This needs to be done separately from the subquery inside
       // any aggregate in the select list, and after the aggregate rel
       // is allocated.
-      replaceSubqueries(bb, selectList, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
+      replaceSubQueries(bb, selectList, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
 
       // Now subqueries in the entire select list have been converted.
       // Convert the select expressions to get the final list to be
@@ -2640,7 +2645,9 @@ public class SqlToRelConverter {
 
     // implement HAVING (we have already checked that it is non-trivial)
     if (havingExpr != null) {
-      bb.setRoot(RelOptUtil.createFilter(bb.root, havingExpr), false);
+      final RelFactories.FilterFactory factory =
+          RelFactories.DEFAULT_FILTER_FACTORY;
+      bb.setRoot(factory.createFilter(bb.root, havingExpr), false);
     }
 
     // implement the SELECT list
@@ -3444,7 +3451,7 @@ public class SqlToRelConverter {
     SqlNodeList selectList = select.getSelectList();
     selectList = validator.expandStar(selectList, select, false);
 
-    replaceSubqueries(bb, selectList, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
+    replaceSubQueries(bb, selectList, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
 
     List<String> fieldNames = new ArrayList<>();
     final List<RexNode> exprs = new ArrayList<>();
@@ -3581,7 +3588,7 @@ public class SqlToRelConverter {
     for (SqlNode rowConstructor1 : values.getOperandList()) {
       SqlCall rowConstructor = (SqlCall) rowConstructor1;
       Blackboard tmpBb = createBlackboard(bb.scope, null, false);
-      replaceSubqueries(tmpBb, rowConstructor,
+      replaceSubQueries(tmpBb, rowConstructor,
           RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
       final List<Pair<RexNode, String>> exps = new ArrayList<>();
       for (Ord<SqlNode> operand : Ord.zip(rowConstructor.getOperandList())) {
@@ -3642,7 +3649,7 @@ public class SqlToRelConverter {
      * List of <code>IN</code> and <code>EXISTS</code> nodes inside this
      * <code>SELECT</code> statement (but not inside sub-queries).
      */
-    private final Set<SubQuery> subqueryList = Sets.newLinkedHashSet();
+    private final Set<SubQuery> subQueryList = new LinkedHashSet<>();
 
     private boolean subqueryNeedsOuterJoin;
 
@@ -3992,17 +3999,17 @@ public class SqlToRelConverter {
       }
     }
 
-    void registerSubquery(SqlNode node, RelOptUtil.Logic logic) {
-      for (SubQuery subQuery : subqueryList) {
+    void registerSubQuery(SqlNode node, RelOptUtil.Logic logic) {
+      for (SubQuery subQuery : subQueryList) {
         if (node.equalsDeep(subQuery.node, Litmus.IGNORE)) {
           return;
         }
       }
-      subqueryList.add(new SubQuery(node, logic));
+      subQueryList.add(new SubQuery(node, logic));
     }
 
-    SubQuery getSubquery(SqlNode expr) {
-      for (SubQuery subQuery : subqueryList) {
+    SubQuery getSubQuery(SqlNode expr) {
+      for (SubQuery subQuery : subQueryList) {
         if (expr.equalsDeep(subQuery.node, Litmus.IGNORE)) {
           return subQuery;
         }
@@ -4103,7 +4110,7 @@ public class SqlToRelConverter {
       switch (kind) {
       case CURSOR:
       case IN:
-        subQuery = getSubquery(expr);
+        subQuery = getSubQuery(expr);
 
         assert subQuery != null;
         rex = subQuery.expr;
@@ -4113,7 +4120,7 @@ public class SqlToRelConverter {
       case SELECT:
       case EXISTS:
       case SCALAR_QUERY:
-        subQuery = getSubquery(expr);
+        subQuery = getSubQuery(expr);
         assert subQuery != null;
         rex = subQuery.expr;
         assert rex != null : "rex != null";
@@ -4199,7 +4206,6 @@ public class SqlToRelConverter {
       return false;
     }
 
-    // implement SqlRexContext
     public int getGroupCount() {
       if (agg != null) {
         return agg.groupExprs.size();
@@ -4210,34 +4216,28 @@ public class SqlToRelConverter {
       return -1;
     }
 
-    // implement SqlRexContext
     public RexBuilder getRexBuilder() {
       return rexBuilder;
     }
 
-    // implement SqlRexContext
-    public RexRangeRef getSubqueryExpr(SqlCall call) {
-      final SubQuery subQuery = getSubquery(call);
+    public RexRangeRef getSubQueryExpr(SqlCall call) {
+      final SubQuery subQuery = getSubQuery(call);
       assert subQuery != null;
       return (RexRangeRef) subQuery.expr;
     }
 
-    // implement SqlRexContext
     public RelDataTypeFactory getTypeFactory() {
       return typeFactory;
     }
 
-    // implement SqlRexContext
     public DefaultValueFactory getDefaultValueFactory() {
       return defaultValueFactory;
     }
 
-    // implement SqlRexContext
     public SqlValidator getValidator() {
       return validator;
     }
 
-    // implement SqlRexContext
     public RexNode convertLiteral(SqlLiteral literal) {
       return exprConverter.convertLiteral(this, literal);
     }
@@ -4246,12 +4246,10 @@ public class SqlToRelConverter {
       return exprConverter.convertInterval(this, intervalQualifier);
     }
 
-    // implement SqlVisitor
     public RexNode visit(SqlLiteral literal) {
       return exprConverter.convertLiteral(this, literal);
     }
 
-    // implement SqlVisitor
     public RexNode visit(SqlCall call) {
       if (agg != null) {
         final SqlOperator op = call.getOperator();
@@ -4264,27 +4262,22 @@ public class SqlToRelConverter {
           new SqlCallBinding(validator, scope, call).permutedCall());
     }
 
-    // implement SqlVisitor
     public RexNode visit(SqlNodeList nodeList) {
       throw new UnsupportedOperationException();
     }
 
-    // implement SqlVisitor
     public RexNode visit(SqlIdentifier id) {
       return convertIdentifier(this, id);
     }
 
-    // implement SqlVisitor
     public RexNode visit(SqlDataTypeSpec type) {
       throw new UnsupportedOperationException();
     }
 
-    // implement SqlVisitor
     public RexNode visit(SqlDynamicParam param) {
       return convertDynamicParam(param);
     }
 
-    // implement SqlVisitor
     public RexNode visit(SqlIntervalQualifier intervalQualifier) {
       return convertInterval(intervalQualifier);
     }
@@ -4345,12 +4338,10 @@ public class SqlToRelConverter {
    * A default implementation of SubqueryConverter that does no conversion.
    */
   private class NoOpSubqueryConverter implements SubqueryConverter {
-    // implement SubqueryConverter
     public boolean canConvertSubquery() {
       return false;
     }
 
-    // implement SubqueryConverter
     public RexNode convertSubquery(
         SqlCall subquery,
         SqlToRelConverter parentConverter,

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java b/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
index fdac4d9..da28296 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
@@ -70,6 +70,7 @@ import org.apache.calcite.sql.type.SqlOperandTypeChecker;
 import org.apache.calcite.sql.type.SqlTypeFamily;
 import org.apache.calcite.sql.type.SqlTypeName;
 import org.apache.calcite.sql.type.SqlTypeUtil;
+import org.apache.calcite.sql.validate.SqlValidator;
 import org.apache.calcite.util.Util;
 
 import com.google.common.collect.ImmutableList;
@@ -394,7 +395,7 @@ public class StandardConvertletTable extends ReflectiveConvertletTable {
       SqlCall call) {
     final RelDataType originalType =
         cx.getValidator().getValidatedNodeType(call);
-    RexRangeRef rr = cx.getSubqueryExpr(call);
+    RexRangeRef rr = cx.getSubQueryExpr(call);
     assert rr != null;
     RelDataType msType = rr.getType().getFieldList().get(0).getType();
     RexNode expr =
@@ -436,7 +437,7 @@ public class StandardConvertletTable extends ReflectiveConvertletTable {
       SqlCall call) {
     final RelDataType originalType =
         cx.getValidator().getValidatedNodeType(call);
-    RexRangeRef rr = cx.getSubqueryExpr(call);
+    RexRangeRef rr = cx.getSubQueryExpr(call);
     assert rr != null;
     RelDataType msType = rr.getType().getFieldList().get(0).getType();
     RexNode expr =
@@ -1289,12 +1290,22 @@ public class StandardConvertletTable extends ReflectiveConvertletTable {
       SqlRexContext cx,
       SqlCall call,
       RexNode value) {
-    final RelDataType resType =
-        cx.getValidator().getValidatedNodeType(call);
-    if (value.getType() == resType) {
-      return value;
+    return castToValidatedType(call, value, cx.getValidator(),
+        cx.getRexBuilder());
+  }
+
+  /**
+   * Casts a RexNode value to the validated type of a SqlCall. If the value
+   * was already of the validated type, then the value is returned without an
+   * additional cast.
+   */
+  public static RexNode castToValidatedType(SqlNode node, RexNode e,
+      SqlValidator validator, RexBuilder rexBuilder) {
+    final RelDataType type = validator.getValidatedNodeType(node);
+    if (e.getType() == type) {
+      return e;
     }
-    return cx.getRexBuilder().makeCast(resType, value);
+    return rexBuilder.makeCast(type, e);
   }
 
   /** Convertlet that handles {@code AVG} and {@code VARIANCE}

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
index c22707a..6f891b9 100644
--- a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
+++ b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
@@ -384,7 +384,7 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in
-   * query and columns selected are subset of columns in materialized view */
+   * query and columns selected are subset of columns in materialized view. */
   @Test public void testFilterQueryOnFilterView5() {
     checkMaterialize(
             "select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10",
@@ -392,7 +392,7 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in
-   * query and columns selected are subset of columns in materialized view */
+   * query and columns selected are subset of columns in materialized view. */
   @Test public void testFilterQueryOnFilterView6() {
     checkMaterialize(
             "select \"name\", \"deptno\", \"salary\" from \"emps\" "
@@ -401,8 +401,8 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in
-   * query and columns selected are subset of columns in materialized view
-   * Condition here is complex*/
+   * query and columns selected are subset of columns in materialized view.
+   * Condition here is complex. */
   @Test public void testFilterQueryOnFilterView7() {
     checkMaterialize(
             "select * from \"emps\" where "
@@ -414,8 +414,8 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in
-   * query. However, columns selected are not present in columns of materialized view,
-   * hence should not use materialized view*/
+   * query. However, columns selected are not present in columns of materialized
+   * view, Hence should not use materialized view. */
   @Test public void testFilterQueryOnFilterView8() {
     checkNoMaterialize(
             "select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10",
@@ -424,7 +424,7 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView()} but condition is weaker in
-   * query.*/
+   * query. */
   @Test public void testFilterQueryOnFilterView9() {
     checkNoMaterialize(
             "select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10",
@@ -432,9 +432,9 @@ public class MaterializationTest {
                 + "where \"deptno\" > 30 or \"empid\" > 10",
             JdbcTest.HR_MODEL);
   }
+
   /** As {@link #testFilterQueryOnFilterView()} but condition currently
-   * has unsupported type being checked on query.
-   */
+   * has unsupported type being checked on query. */
   @Test public void testFilterQueryOnFilterView10() {
     checkNoMaterialize(
             "select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10 "
@@ -445,8 +445,8 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView()} but condition is weaker in
-   * query and columns selected are subset of columns in materialized view
-   * Condition here is complex*/
+   * query and columns selected are subset of columns in materialized view.
+   * Condition here is complex. */
   @Test public void testFilterQueryOnFilterView11() {
     checkNoMaterialize(
             "select \"name\", \"deptno\" from \"emps\" where "
@@ -467,8 +467,8 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView()} but condition is weaker in
-   * query and columns selected are subset of columns in materialized view
-   * Condition here is complex*/
+   * query and columns selected are subset of columns in materialized view.
+   * Condition here is complex. */
   @Test public void testFilterQueryOnFilterView13() {
     checkNoMaterialize(
             "select * from \"emps\" where "
@@ -480,7 +480,7 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView7()} but columns in materialized
-   * view are a permutation of columns in the query*/
+   * view are a permutation of columns in the query. */
   @Test public void testFilterQueryOnFilterView14() {
     String q = "select * from \"emps\" where (\"salary\" > 1000 "
         + "or (\"deptno\" >= 30 and \"salary\" <= 500))";
@@ -493,7 +493,7 @@ public class MaterializationTest {
   }
 
   /** As {@link #testFilterQueryOnFilterView13()} but using alias
-   * and condition of query is stronger*/
+   * and condition of query is stronger. */
   @Test public void testAlias() {
     checkMaterialize(
             "select * from \"emps\" as em where "

http://git-wip-us.apache.org/repos/asf/calcite/blob/3ccfb9c0/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
index c50b301..bfaa527 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
@@ -919,7 +919,7 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   @Test public void testInValueListLong() {
-    // Go over the default threshold of 20 to force a subQuery.
+    // Go over the default threshold of 20 to force a sub-query.
     final String sql = "select empno from emp where deptno in"
         + " (10, 20, 30, 40, 50, 60, 70, 80, 90, 100"
         + ", 110, 120, 130, 140, 150, 160, 170, 180, 190"
@@ -1146,7 +1146,7 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   @Test public void testUnionSubQuery() {
-    // union of subQuery, inside from list, also values
+    // union of sub-query, inside from list, also values
     final String sql = "select deptno from emp as emp0 cross join\n"
         + " (select empno from emp union all\n"
         + "  select deptno from dept where deptno > 20 union all\n"
@@ -1517,7 +1517,7 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   /**
    * Test case for
    * <a href="https://issues.apache.org/jira/browse/CALCITE-710">[CALCITE-710]
-   * When look up subqueries, perform the same logic as the way when ones were
+   * When look up sub-queries, perform the same logic as the way when ones were
    * registered</a>.
    */
   @Test public void testIdenticalExpressionInSubQuery() {
@@ -1641,7 +1641,7 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   /**
    * Test case for
    * <a href="https://issues.apache.org/jira/browse/CALCITE-770">[CALCITE-770]
-   * variant involving join with subQuery that contains window function and
+   * variant involving join with sub-query that contains window function and
    * GROUP BY</a>.
    */
   @Test public void testWindowAggInSubQueryJoin() {
@@ -1666,9 +1666,9 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   /**
-   * Test case (correlated scalar aggregate subQuery) for
+   * Test case (correlated scalar aggregate sub-query) for
    * <a href="https://issues.apache.org/jira/browse/CALCITE-714">[CALCITE-714]
-   * When de-correlating, push join condition into subQuery</a>.
+   * When de-correlating, push join condition into sub-query</a>.
    */
   @Test public void testCorrelationScalarAggAndFilter() {
     final String sql = "SELECT e1.empno\n"
@@ -1687,9 +1687,9 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   /**
-   * Test case (correlated EXISTS subQuery) for
+   * Test case (correlated EXISTS sub-query) for
    * <a href="https://issues.apache.org/jira/browse/CALCITE-714">[CALCITE-714]
-   * When de-correlating, push join condition into subQuery</a>.
+   * When de-correlating, push join condition into sub-query</a>.
    */
   @Test public void testCorrelationExistsAndFilter() {
     final String sql = "SELECT e1.empno\n"
@@ -1708,9 +1708,9 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   /**
-   * Test case (correlated NOT EXISTS subQuery) for
+   * Test case (correlated NOT EXISTS sub-query) for
    * <a href="https://issues.apache.org/jira/browse/CALCITE-714">[CALCITE-714]
-   * When de-correlating, push join condition into subQuery</a>.
+   * When de-correlating, push join condition into sub-query</a>.
    */
   @Test public void testCorrelationNotExistsAndFilter() {
     final String sql = "SELECT e1.empno\n"


Mime
View raw message