You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2014/11/14 22:32:17 UTC

[09/58] [abbrv] [partial] incubator-calcite git commit: [CALCITE-306] Standardize code style for "import package.*; "

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/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 efd16e3..db202f8 100644
--- a/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
+++ b/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
@@ -14,50 +14,79 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package net.hydromatic.optiq.tools;
-
-import net.hydromatic.optiq.SchemaPlus;
-import net.hydromatic.optiq.config.Lex;
-import net.hydromatic.optiq.impl.java.ReflectiveSchema;
-import net.hydromatic.optiq.impl.jdbc.*;
-import net.hydromatic.optiq.impl.jdbc.JdbcRules.JdbcProjectRel;
-import net.hydromatic.optiq.rules.java.EnumerableConvention;
-import net.hydromatic.optiq.rules.java.JavaRules;
-import net.hydromatic.optiq.rules.java.JavaRules.EnumerableProjectRel;
-import net.hydromatic.optiq.test.OptiqAssert;
-
-import org.eigenbase.rel.*;
-import org.eigenbase.rel.convert.ConverterRule;
-import org.eigenbase.rel.metadata.RelMetadataQuery;
-import org.eigenbase.rel.rules.*;
-import org.eigenbase.relopt.*;
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
-import org.eigenbase.sql.*;
-import org.eigenbase.sql.fun.SqlStdOperatorTable;
-import org.eigenbase.sql.parser.SqlParseException;
-import org.eigenbase.sql.type.*;
-import org.eigenbase.sql.util.ChainedSqlOperatorTable;
-import org.eigenbase.sql.util.ListSqlOperatorTable;
-import org.eigenbase.sql.validate.SqlValidator;
-import org.eigenbase.sql.validate.SqlValidatorScope;
-import org.eigenbase.util.Util;
+package org.apache.calcite.tools;
+
+import org.apache.calcite.adapter.enumerable.EnumerableConvention;
+import org.apache.calcite.adapter.enumerable.EnumerableProject;
+import org.apache.calcite.adapter.enumerable.EnumerableRules;
+import org.apache.calcite.adapter.enumerable.EnumerableTableScan;
+import org.apache.calcite.adapter.java.ReflectiveSchema;
+import org.apache.calcite.adapter.jdbc.JdbcConvention;
+import org.apache.calcite.adapter.jdbc.JdbcImplementor;
+import org.apache.calcite.adapter.jdbc.JdbcRel;
+import org.apache.calcite.adapter.jdbc.JdbcRules;
+import org.apache.calcite.config.Lex;
+import org.apache.calcite.plan.ConventionTraitDef;
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelOptPlanner;
+import org.apache.calcite.plan.RelOptPredicateList;
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptTable;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelTraitDef;
+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;
+import org.apache.calcite.rel.rules.SortRemoveRule;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.sql.SqlAggFunction;
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlDialect;
+import org.apache.calcite.sql.SqlExplainLevel;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.SqlOperatorTable;
+import org.apache.calcite.sql.fun.SqlStdOperatorTable;
+import org.apache.calcite.sql.parser.SqlParseException;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.sql.util.ChainedSqlOperatorTable;
+import org.apache.calcite.sql.util.ListSqlOperatorTable;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+import org.apache.calcite.test.CalciteAssert;
+import org.apache.calcite.util.Util;
 
 import com.google.common.collect.ImmutableList;
 
 import org.junit.Test;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
 
 /**
  * Unit tests for {@link Planner}.
  */
 public class PlannerTest {
   private void checkParseAndConvert(String query,
-    String queryFromParseTree, String expectedRelExpr) throws Exception {
+      String queryFromParseTree, String expectedRelExpr) throws Exception {
     Planner planner = getPlanner(null);
     SqlNode parse = planner.parse(query);
     assertThat(Util.toLinux(parse.toString()), equalTo(queryFromParseTree));
@@ -75,9 +104,9 @@ public class PlannerTest {
             + "FROM `emps`\n"
             + "WHERE `name` LIKE '%e%'",
 
-        "ProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-            + "  FilterRel(condition=[LIKE($2, '%e%')])\n"
-            + "    EnumerableTableAccessRel(table=[[hr, emps]])\n");
+        "LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "  LogicalFilter(condition=[LIKE($2, '%e%')])\n"
+            + "    EnumerableTableScan(table=[[hr, emps]])\n");
   }
 
   /** Unit test that parses, validates and converts the query using
@@ -85,16 +114,16 @@ public class PlannerTest {
   @Test public void testParseAndConvertWithOrderByAndOffset() throws Exception {
     checkParseAndConvert(
         "select * from \"emps\" "
-        + "order by \"emps\".\"deptno\" offset 10",
+            + "order by \"emps\".\"deptno\" offset 10",
 
         "SELECT *\n"
-        + "FROM `emps`\n"
-        + "ORDER BY `emps`.`deptno`\n"
-        + "OFFSET 10 ROWS",
+            + "FROM `emps`\n"
+            + "ORDER BY `emps`.`deptno`\n"
+            + "OFFSET 10 ROWS",
 
-        "SortRel(sort0=[$1], dir0=[ASC], offset=[10])\n"
-        + "  ProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-        + "    EnumerableTableAccessRel(table=[[hr, emps]])\n");
+        "Sort(sort0=[$1], dir0=[ASC], offset=[10])\n"
+            + "  LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "    EnumerableTableScan(table=[[hr, emps]])\n");
   }
 
   private String toString(RelNode rel) {
@@ -119,10 +148,10 @@ public class PlannerTest {
     Planner planner = getPlanner(null);
     SqlNode parse =
         planner.parse("select * from \"emps\" where \"Xname\" like '%e%'");
-    assertThat(Util.toLinux(parse.toString()), equalTo(
-        "SELECT *\n"
-        + "FROM `emps`\n"
-        + "WHERE `Xname` LIKE '%e%'"));
+    assertThat(Util.toLinux(parse.toString()),
+        equalTo("SELECT *\n"
+            + "FROM `emps`\n"
+            + "WHERE `Xname` LIKE '%e%'"));
 
     try {
       SqlNode validate = planner.validate(parse);
@@ -143,7 +172,7 @@ public class PlannerTest {
     final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
     final FrameworkConfig config = Frameworks.newConfigBuilder()
         .defaultSchema(
-            OptiqAssert.addSchema(rootSchema, OptiqAssert.SchemaSpec.HR))
+            CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.HR))
         .operatorTable(opTab)
         .build();
     final Planner planner = Frameworks.getPlanner(config);
@@ -151,8 +180,7 @@ public class PlannerTest {
         planner.parse("select \"deptno\", my_count(\"empid\") from \"emps\"\n"
             + "group by \"deptno\"");
     assertThat(Util.toLinux(parse.toString()),
-        equalTo(
-            "SELECT `deptno`, `MY_COUNT`(`empid`)\n"
+        equalTo("SELECT `deptno`, `MY_COUNT`(`empid`)\n"
             + "FROM `emps`\n"
             + "GROUP BY `deptno`"));
 
@@ -180,7 +208,7 @@ public class PlannerTest {
     final FrameworkConfig config = Frameworks.newConfigBuilder()
         .lex(Lex.ORACLE)
         .defaultSchema(
-            OptiqAssert.addSchema(rootSchema, OptiqAssert.SchemaSpec.HR))
+            CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.HR))
         .traitDefs(traitDefs)
         .programs(programs)
         .build();
@@ -188,8 +216,8 @@ public class PlannerTest {
   }
 
   /** Tests that planner throws an error if you pass to
-   * {@link Planner#convert(org.eigenbase.sql.SqlNode)}
-   * a {@link org.eigenbase.sql.SqlNode} that has been parsed but not
+   * {@link Planner#convert(org.apache.calcite.sql.SqlNode)}
+   * a {@link org.apache.calcite.sql.SqlNode} that has been parsed but not
    * validated. */
   @Test public void testConvertWithoutValidateFails() throws Exception {
     Planner planner = getPlanner(null);
@@ -221,8 +249,8 @@ public class PlannerTest {
   @Test public void testMetadataUnionPredicates() throws Exception {
     checkMetadataUnionPredicates(
         "select * from \"emps\" where \"deptno\" < 10\n"
-        + "union all\n"
-        + "select * from \"emps\" where \"empid\" > 2",
+            + "union all\n"
+            + "select * from \"emps\" where \"empid\" > 2",
         "[OR(<($1, 10), >($0, 2))]");
   }
 
@@ -232,8 +260,8 @@ public class PlannerTest {
   @Test public void testMetadataUnionPredicates2() throws Exception {
     checkMetadataUnionPredicates(
         "select * from \"emps\" where \"deptno\" < 10\n"
-        + "union all\n"
-        + "select * from \"emps\"",
+            + "union all\n"
+            + "select * from \"emps\"",
         "[]");
   }
 
@@ -242,16 +270,16 @@ public class PlannerTest {
     // could be simplified to [<($1, 10)] but is nevertheless correct.
     checkMetadataUnionPredicates(
         "select * from \"emps\" where \"deptno\" < 10\n"
-        + "union all\n"
-        + "select * from \"emps\" where \"deptno\" < 10 and \"empid\" > 1",
+            + "union all\n"
+            + "select * from \"emps\" where \"deptno\" < 10 and \"empid\" > 1",
         "[OR(<($1, 10), AND(<($1, 10), >($0, 1)))]");
   }
 
   @Test public void testMetadataUnionPredicates4() throws Exception {
     checkMetadataUnionPredicates(
         "select * from \"emps\" where \"deptno\" < 10\n"
-        + "union all\n"
-        + "select * from \"emps\" where \"deptno\" < 10 or \"empid\" > 1",
+            + "union all\n"
+            + "select * from \"emps\" where \"deptno\" < 10 or \"empid\" > 1",
         "[OR(<($1, 10), <($1, 10), >($0, 1))]");
   }
 
@@ -259,9 +287,9 @@ public class PlannerTest {
   @Test public void testPlan() throws Exception {
     Program program =
         Programs.ofRules(
-            MergeFilterRule.INSTANCE,
-            JavaRules.ENUMERABLE_FILTER_RULE,
-            JavaRules.ENUMERABLE_PROJECT_RULE);
+            FilterMergeRule.INSTANCE,
+            EnumerableRules.ENUMERABLE_FILTER_RULE,
+            EnumerableRules.ENUMERABLE_PROJECT_RULE);
     Planner planner = getPlanner(null, program);
     SqlNode parse = planner.parse("select * from \"emps\"");
     SqlNode validate = planner.validate(parse);
@@ -270,8 +298,8 @@ public class PlannerTest {
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
     assertThat(toString(transform), equalTo(
-        "EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-        + "  EnumerableTableAccessRel(table=[[hr, emps]])\n"));
+        "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "  EnumerableTableScan(table=[[hr, emps]])\n"));
   }
 
   /** Unit test that parses, validates, converts and
@@ -279,9 +307,9 @@ public class PlannerTest {
   @Test public void testSortPlan() throws Exception {
     RuleSet ruleSet =
         RuleSets.ofList(
-            RemoveSortRule.INSTANCE,
-            JavaRules.ENUMERABLE_PROJECT_RULE,
-            JavaRules.ENUMERABLE_SORT_RULE);
+            SortRemoveRule.INSTANCE,
+            EnumerableRules.ENUMERABLE_PROJECT_RULE,
+            EnumerableRules.ENUMERABLE_SORT_RULE);
     Planner planner = getPlanner(null, Programs.of(ruleSet));
     SqlNode parse = planner.parse(
         "select * from \"emps\" "
@@ -292,38 +320,38 @@ public class PlannerTest {
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
     assertThat(toString(transform), equalTo(
-        "EnumerableSortRel(sort0=[$1], dir0=[ASC])\n"
-        + "  EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-        + "    EnumerableTableAccessRel(table=[[hr, emps]])\n"));
+        "EnumerableSort(sort0=[$1], dir0=[ASC])\n"
+            + "  EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "    EnumerableTableScan(table=[[hr, emps]])\n"));
   }
 
   /** Unit test that parses, validates, converts and
    * plans for query using two duplicate order by.
-   * The duplicate order by should be removed by RemoveSortRule*/
+   * The duplicate order by should be removed by SortRemoveRule*/
   @Test public void testDuplicateSortPlan() throws Exception {
     RuleSet ruleSet =
         RuleSets.ofList(
-            RemoveSortRule.INSTANCE,
-            JavaRules.ENUMERABLE_PROJECT_RULE,
-            JavaRules.ENUMERABLE_SORT_RULE);
+            SortRemoveRule.INSTANCE,
+            EnumerableRules.ENUMERABLE_PROJECT_RULE,
+            EnumerableRules.ENUMERABLE_SORT_RULE);
     Planner planner = getPlanner(null, Programs.of(ruleSet));
     SqlNode parse = planner.parse(
         "select \"empid\" from ( "
-         + "select * "
-         + "from \"emps\" "
-         + "order by \"emps\".\"deptno\") "
-         + "order by \"deptno\"");
+            + "select * "
+            + "from \"emps\" "
+            + "order by \"emps\".\"deptno\") "
+            + "order by \"deptno\"");
     SqlNode validate = planner.validate(parse);
     RelNode convert = planner.convert(validate);
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
     assertThat(toString(transform), equalTo(
-        "EnumerableProjectRel(empid=[$0])\n"
-        + "  EnumerableProjectRel(empid=[$0], deptno=[$1])\n"
-        + "    EnumerableSortRel(sort0=[$1], dir0=[ASC])\n"
-        + "      EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-        + "        EnumerableTableAccessRel(table=[[hr, emps]])\n"));
+        "EnumerableProject(empid=[$0])\n"
+            + "  EnumerableProject(empid=[$0], deptno=[$1])\n"
+            + "    EnumerableSort(sort0=[$1], dir0=[ASC])\n"
+            + "      EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "        EnumerableTableScan(table=[[hr, emps]])\n"));
   }
 
   /** Unit test that parses, validates, converts and
@@ -331,8 +359,8 @@ public class PlannerTest {
   @Test public void testDuplicateSortPlanWORemoveSortRule() throws Exception {
     RuleSet ruleSet =
         RuleSets.ofList(
-            JavaRules.ENUMERABLE_PROJECT_RULE,
-            JavaRules.ENUMERABLE_SORT_RULE);
+            EnumerableRules.ENUMERABLE_PROJECT_RULE,
+            EnumerableRules.ENUMERABLE_SORT_RULE);
     Planner planner = getPlanner(null, Programs.of(ruleSet));
     SqlNode parse = planner.parse(
         "select \"empid\" from ( "
@@ -346,12 +374,12 @@ public class PlannerTest {
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
     assertThat(toString(transform), equalTo(
-        "EnumerableProjectRel(empid=[$0])\n"
-        + "  EnumerableSortRel(sort0=[$1], dir0=[ASC])\n"
-        + "    EnumerableProjectRel(empid=[$0], deptno=[$1])\n"
-        + "      EnumerableSortRel(sort0=[$1], dir0=[ASC])\n"
-        + "        EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-        + "          EnumerableTableAccessRel(table=[[hr, emps]])\n"));
+        "EnumerableProject(empid=[$0])\n"
+            + "  EnumerableSort(sort0=[$1], dir0=[ASC])\n"
+            + "    EnumerableProject(empid=[$0], deptno=[$1])\n"
+            + "      EnumerableSort(sort0=[$1], dir0=[ASC])\n"
+            + "        EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "          EnumerableTableScan(table=[[hr, emps]])\n"));
   }
 
   /** Unit test that parses, validates, converts and plans. Planner is
@@ -359,9 +387,9 @@ public class PlannerTest {
   @Test public void testPlanWithExplicitTraitDefs() throws Exception {
     RuleSet ruleSet =
         RuleSets.ofList(
-            MergeFilterRule.INSTANCE,
-            JavaRules.ENUMERABLE_FILTER_RULE,
-            JavaRules.ENUMERABLE_PROJECT_RULE);
+            FilterMergeRule.INSTANCE,
+            EnumerableRules.ENUMERABLE_FILTER_RULE,
+            EnumerableRules.ENUMERABLE_PROJECT_RULE);
     final List<RelTraitDef> traitDefs = new ArrayList<RelTraitDef>();
     traitDefs.add(ConventionTraitDef.INSTANCE);
     traitDefs.add(RelCollationTraitDef.INSTANCE);
@@ -375,17 +403,17 @@ public class PlannerTest {
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
     assertThat(toString(transform), equalTo(
-        "EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-        + "  EnumerableTableAccessRel(table=[[hr, emps]])\n"));
+        "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "  EnumerableTableScan(table=[[hr, emps]])\n"));
   }
 
   /** Unit test that calls {@link Planner#transform} twice. */
   @Test public void testPlanTransformTwice() throws Exception {
     RuleSet ruleSet =
         RuleSets.ofList(
-            MergeFilterRule.INSTANCE,
-            JavaRules.ENUMERABLE_FILTER_RULE,
-            JavaRules.ENUMERABLE_PROJECT_RULE);
+            FilterMergeRule.INSTANCE,
+            EnumerableRules.ENUMERABLE_FILTER_RULE,
+            EnumerableRules.ENUMERABLE_PROJECT_RULE);
     Planner planner = getPlanner(null, Programs.of(ruleSet));
     SqlNode parse = planner.parse("select * from \"emps\"");
     SqlNode validate = planner.validate(parse);
@@ -395,8 +423,8 @@ public class PlannerTest {
     RelNode transform = planner.transform(0, traitSet, convert);
     RelNode transform2 = planner.transform(0, traitSet, transform);
     assertThat(toString(transform2), equalTo(
-        "EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
-        + "  EnumerableTableAccessRel(table=[[hr, emps]])\n"));
+        "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n"
+            + "  EnumerableTableScan(table=[[hr, emps]])\n"));
   }
 
   /** Tests that Hive dialect does not generate "AS". */
@@ -417,7 +445,7 @@ public class PlannerTest {
   /** Unit test that calls {@link Planner#transform} twice,
    * with different rule sets, with different conventions.
    *
-   * <p>{@link net.hydromatic.optiq.impl.jdbc.JdbcConvention} is different
+   * <p>{@link org.apache.calcite.adapter.jdbc.JdbcConvention} is different
    * from the typical convention in that it is not a singleton. Switching to
    * a different instance causes problems unless planner state is wiped clean
    * between calls to {@link Planner#transform}. */
@@ -425,9 +453,9 @@ public class PlannerTest {
       throws Exception {
     Program program0 =
         Programs.ofRules(
-            MergeFilterRule.INSTANCE,
-            JavaRules.ENUMERABLE_FILTER_RULE,
-            JavaRules.ENUMERABLE_PROJECT_RULE);
+            FilterMergeRule.INSTANCE,
+            EnumerableRules.ENUMERABLE_FILTER_RULE,
+            EnumerableRules.ENUMERABLE_PROJECT_RULE);
 
     JdbcConvention out = new JdbcConvention(null, null, "myjdbc");
     Program program1 = Programs.ofRules(
@@ -448,8 +476,8 @@ public class PlannerTest {
     RelNode transform = planner.transform(0, traitSet0, convert);
     RelNode transform2 = planner.transform(1, traitSet1, transform);
     assertThat(toString(transform2), equalTo(
-        "JdbcProjectRel(name=[$2])\n"
-        + "  MockJdbcTableScan(table=[[hr, emps]])\n"));
+        "JdbcProject(name=[$2])\n"
+            + "  MockJdbcTableScan(table=[[hr, emps]])\n"));
   }
 
   /** Unit test that plans a query with a large number of joins. */
@@ -476,7 +504,7 @@ public class PlannerTest {
     checkJoinNWay(5); // LoptOptimizeJoinRule disabled; takes about .4s
     checkJoinNWay(9); // LoptOptimizeJoinRule enabled; takes about 0.04s
     checkJoinNWay(35); // takes about 2s
-    if (OptiqAssert.ENABLE_SLOW) {
+    if (CalciteAssert.ENABLE_SLOW) {
       checkJoinNWay(60); // takes about 15s
     }
   }
@@ -503,15 +531,16 @@ public class PlannerTest {
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
     assertThat(toString(transform), containsString(
-        "EnumerableJoinRel(condition=[=($0, $3)], joinType=[inner])"));
+        "EnumerableJoin(condition=[=($0, $3)], joinType=[inner])"));
   }
 
   /** Test case for
    * <a href="https://issues.apache.org/jira/browse/CALCITE-435">CALCITE-435</a>,
    * "LoptOptimizeJoinRule incorrectly re-orders outer joins".
    *
-   * <p>Checks the {@link org.eigenbase.rel.rules.LoptOptimizeJoinRule} on a
-   * query with a left outer join.
+   * <p>Checks the
+   * {@link org.apache.calcite.rel.rules.LoptOptimizeJoinRule} on a query with a
+   * left outer join.
    *
    * <p>Specifically, tests that a relation (dependents) in an inner join
    * cannot be pushed into an outer join (emps left join depts).
@@ -519,16 +548,16 @@ public class PlannerTest {
   @Test public void testHeuristicLeftJoin() throws Exception {
     checkHeuristic(
         "select * from \"emps\" as e\n"
-        + "left join \"depts\" as d using (\"deptno\")\n"
-        + "join \"dependents\" as p on e.\"empid\" = p.\"empid\"",
-        "EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7], empid0=[$8], name1=[$9])\n"
-        + "  EnumerableProjectRel(empid=[$2], deptno=[$3], name=[$4], salary=[$5], commission=[$6], deptno0=[$7], name0=[$8], employees=[$9], empid0=[$0], name1=[$1])\n"
-        + "    EnumerableJoinRel(condition=[=($0, $2)], joinType=[inner])\n"
-        + "      EnumerableTableAccessRel(table=[[hr, dependents]])\n"
-        + "      EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7])\n"
-        + "        EnumerableJoinRel(condition=[=($1, $5)], joinType=[left])\n"
-        + "          EnumerableTableAccessRel(table=[[hr, emps]])\n"
-        + "          EnumerableTableAccessRel(table=[[hr, depts]])");
+            + "left join \"depts\" as d using (\"deptno\")\n"
+            + "join \"dependents\" as p on e.\"empid\" = p.\"empid\"",
+        "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7], empid0=[$8], name1=[$9])\n"
+            + "  EnumerableProject(empid=[$2], deptno=[$3], name=[$4], salary=[$5], commission=[$6], deptno0=[$7], name0=[$8], employees=[$9], empid0=[$0], name1=[$1])\n"
+            + "    EnumerableJoin(condition=[=($0, $2)], joinType=[inner])\n"
+            + "      EnumerableTableScan(table=[[hr, dependents]])\n"
+            + "      EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7])\n"
+            + "        EnumerableJoin(condition=[=($1, $5)], joinType=[left])\n"
+            + "          EnumerableTableScan(table=[[hr, emps]])\n"
+            + "          EnumerableTableScan(table=[[hr, depts]])");
   }
 
   /** It would probably be OK to transform
@@ -540,16 +569,16 @@ public class PlannerTest {
   @Test public void testHeuristicPushInnerJoin() throws Exception {
     checkHeuristic(
         "select * from \"emps\" as e\n"
-        + "right join \"depts\" as d using (\"deptno\")\n"
-        + "join \"dependents\" as p on e.\"empid\" = p.\"empid\"",
-        "EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7], empid0=[$8], name1=[$9])\n"
-        + "  EnumerableProjectRel(empid=[$2], deptno=[$3], name=[$4], salary=[$5], commission=[$6], deptno0=[$7], name0=[$8], employees=[$9], empid0=[$0], name1=[$1])\n"
-        + "    EnumerableJoinRel(condition=[=($0, $2)], joinType=[inner])\n"
-        + "      EnumerableTableAccessRel(table=[[hr, dependents]])\n"
-        + "      EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7])\n"
-        + "        EnumerableJoinRel(condition=[=($1, $5)], joinType=[right])\n"
-        + "          EnumerableTableAccessRel(table=[[hr, emps]])\n"
-        + "          EnumerableTableAccessRel(table=[[hr, depts]])");
+            + "right join \"depts\" as d using (\"deptno\")\n"
+            + "join \"dependents\" as p on e.\"empid\" = p.\"empid\"",
+        "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7], empid0=[$8], name1=[$9])\n"
+            + "  EnumerableProject(empid=[$2], deptno=[$3], name=[$4], salary=[$5], commission=[$6], deptno0=[$7], name0=[$8], employees=[$9], empid0=[$0], name1=[$1])\n"
+            + "    EnumerableJoin(condition=[=($0, $2)], joinType=[inner])\n"
+            + "      EnumerableTableScan(table=[[hr, dependents]])\n"
+            + "      EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7])\n"
+            + "        EnumerableJoin(condition=[=($1, $5)], joinType=[right])\n"
+            + "          EnumerableTableScan(table=[[hr, emps]])\n"
+            + "          EnumerableTableScan(table=[[hr, depts]])");
   }
 
   /** Tests that a relation (dependents) that is on the null-generating side of
@@ -557,16 +586,16 @@ public class PlannerTest {
   @Test public void testHeuristicRightJoin() throws Exception {
     checkHeuristic(
         "select * from \"emps\" as e\n"
-        + "join \"depts\" as d using (\"deptno\")\n"
-        + "right join \"dependents\" as p on e.\"empid\" = p.\"empid\"",
-        "EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7], empid0=[$8], name1=[$9])\n"
-        + "  EnumerableProjectRel(empid=[$2], deptno=[$3], name=[$4], salary=[$5], commission=[$6], deptno0=[$7], name0=[$8], employees=[$9], empid0=[$0], name1=[$1])\n"
-        + "    EnumerableJoinRel(condition=[=($0, $2)], joinType=[left])\n"
-        + "      EnumerableTableAccessRel(table=[[hr, dependents]])\n"
-        + "      EnumerableProjectRel(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7])\n"
-        + "        EnumerableJoinRel(condition=[=($1, $5)], joinType=[inner])\n"
-        + "          EnumerableTableAccessRel(table=[[hr, emps]])\n"
-        + "          EnumerableTableAccessRel(table=[[hr, depts]])");
+            + "join \"depts\" as d using (\"deptno\")\n"
+            + "right join \"dependents\" as p on e.\"empid\" = p.\"empid\"",
+        "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7], empid0=[$8], name1=[$9])\n"
+            + "  EnumerableProject(empid=[$2], deptno=[$3], name=[$4], salary=[$5], commission=[$6], deptno0=[$7], name0=[$8], employees=[$9], empid0=[$0], name1=[$1])\n"
+            + "    EnumerableJoin(condition=[=($0, $2)], joinType=[left])\n"
+            + "      EnumerableTableScan(table=[[hr, dependents]])\n"
+            + "      EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4], deptno0=[$5], name0=[$6], employees=[$7])\n"
+            + "        EnumerableJoin(condition=[=($1, $5)], joinType=[inner])\n"
+            + "          EnumerableTableScan(table=[[hr, emps]])\n"
+            + "          EnumerableTableScan(table=[[hr, depts]])");
   }
 
   private void checkHeuristic(String sql, String expected) throws Exception {
@@ -585,20 +614,20 @@ public class PlannerTest {
    * bushy, but nevertheless exercises the bushy-join heuristic optimizer. */
   @Test public void testAlmostBushy() throws Exception {
     checkBushy("select *\n"
-        + "from \"sales_fact_1997\" as s\n"
-        + "  join \"customer\" as c using (\"customer_id\")\n"
-        + "  join \"product\" as p using (\"product_id\")\n"
-        + "where c.\"city\" = 'San Francisco'\n"
-        + "and p.\"brand_name\" = 'Washington'",
-        "EnumerableProjectRel(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], product_class_id=[$37], product_id0=[$38], brand_name=[$39], product_name=[$40], SKU=[$41], SRP=[$42], gross_weight=[$43], net_weight=[$44], recyclable_package=[$45], low_fat=[$46], units_per_case=[$47], cases_per_pallet=[$48], shelf_width=[$49], shelf_height=[$50], shelf_depth=[$51])\n"
-        + "  EnumerableProjectRel($f0=[$44], $f1=[$45], $f2=[$46], $f3=[$47], $f4=[$48], $f5=[$49], $f6=[$50], $f7=[$51], $f8=[$15], $f9=[$16], $f10=[$17], $f11=[$18], $f12=[$19], $f13=[$20], $f14=[$21], $f15=[$22], $f16=[$23], $f17=[$24], $f18=[$25], $f19=[$26], $f20=[$27], $f21=[$28], $f22=[$29], $f23=[$30], $f24=[$31], $f25=[$32], $f26=[$33], $f27=[$34], $f28=[$35], $f29=[$36], $f30=[$37], $f31=[$38], $f32=[$39], $f33=[$40], $f34=[$41], $f35=[$42], $f36=[$43], $f37=[$0], $f38=[$1], $f39=[$2], $f40=[$3], $f41=[$4], $f42=[$5], $f43=[$6], $f44=[$7], $f45=[$8], $f46=[$9], $f47=[$10], $f48=[$11], $f49=[$12], $f50=[$13], $f51=[$14])\n"
-        + "    EnumerableJoinRel(condition=[=($1, $44)], joinType=[inner])\n"
-        + "      EnumerableFilterRel(condition=[=($2, 'Washington')])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, product]])\n"
-        + "      EnumerableJoinRel(condition=[=($0, $31)], joinType=[inner])\n"
-        + "        EnumerableFilterRel(condition=[=($9, 'San Francisco')])\n"
-        + "          EnumerableTableAccessRel(table=[[foodmart2, customer]])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, sales_fact_1997]])\n");
+            + "from \"sales_fact_1997\" as s\n"
+            + "  join \"customer\" as c using (\"customer_id\")\n"
+            + "  join \"product\" as p using (\"product_id\")\n"
+            + "where c.\"city\" = 'San Francisco'\n"
+            + "and p.\"brand_name\" = 'Washington'",
+        "EnumerableProject(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], product_class_id=[$37], product_id0=[$38], brand_name=[$39], product_name=[$40], SKU=[$41], SRP=[$42], gross_weight=[$43], net_weight=[$44], recyclable_package=[$45], low_fat=[$46], units_per_case=[$47], cases_per_pallet=[$48], shelf_width=[$49], shelf_height=[$50], shelf_depth=[$51])\n"
+            + "  EnumerableProject($f0=[$44], $f1=[$45], $f2=[$46], $f3=[$47], $f4=[$48], $f5=[$49], $f6=[$50], $f7=[$51], $f8=[$15], $f9=[$16], $f10=[$17], $f11=[$18], $f12=[$19], $f13=[$20], $f14=[$21], $f15=[$22], $f16=[$23], $f17=[$24], $f18=[$25], $f19=[$26], $f20=[$27], $f21=[$28], $f22=[$29], $f23=[$30], $f24=[$31], $f25=[$32], $f26=[$33], $f27=[$34], $f28=[$35], $f29=[$36], $f30=[$37], $f31=[$38], $f32=[$39], $f33=[$40], $f34=[$41], $f35=[$42], $f36=[$43], $f37=[$0], $f38=[$1], $f39=[$2], $f40=[$3], $f41=[$4], $f42=[$5], $f43=[$6], $f44=[$7], $f45=[$8], $f46=[$9], $f47=[$10], $f48=[$11], $f49=[$12], $f50=[$13], $f51=[$14])\n"
+            + "    EnumerableJoin(condition=[=($1, $44)], joinType=[inner])\n"
+            + "      EnumerableFilter(condition=[=($2, 'Washington')])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, product]])\n"
+            + "      EnumerableJoin(condition=[=($0, $31)], joinType=[inner])\n"
+            + "        EnumerableFilter(condition=[=($9, 'San Francisco')])\n"
+            + "          EnumerableTableScan(table=[[foodmart2, customer]])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, sales_fact_1997]])\n");
   }
 
   /** Plans a 4-table join query on the FoodMart schema.
@@ -610,91 +639,91 @@ public class PlannerTest {
    * if you don't assume 'x' is left-associative. */
   @Test public void testBushy() throws Exception {
     checkBushy("select *\n"
-        + "from \"sales_fact_1997\" as s\n"
-        + "  join \"customer\" as c using (\"customer_id\")\n"
-        + "  join \"product\" as p using (\"product_id\")\n"
-        + "  join \"product_class\" as pc using (\"product_class_id\")\n"
-        + "where c.\"city\" = 'San Francisco'\n"
-        + "and p.\"brand_name\" = 'Washington'",
-        "EnumerableProjectRel(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], product_class_id=[$37], product_id0=[$38], brand_name=[$39], product_name=[$40], SKU=[$41], SRP=[$42], gross_weight=[$43], net_weight=[$44], recyclable_package=[$45], low_fat=[$46], units_per_case=[$47], cases_per_pallet=[$48], shelf_width=[$49], shelf_height=[$50], shelf_depth=[$51], product_class_id0=[$52], pro
 duct_subcategory=[$53], product_category=[$54], product_department=[$55], product_family=[$56])\n"
-        + "  EnumerableProjectRel($f0=[$49], $f1=[$50], $f2=[$51], $f3=[$52], $f4=[$53], $f5=[$54], $f6=[$55], $f7=[$56], $f8=[$0], $f9=[$1], $f10=[$2], $f11=[$3], $f12=[$4], $f13=[$5], $f14=[$6], $f15=[$7], $f16=[$8], $f17=[$9], $f18=[$10], $f19=[$11], $f20=[$12], $f21=[$13], $f22=[$14], $f23=[$15], $f24=[$16], $f25=[$17], $f26=[$18], $f27=[$19], $f28=[$20], $f29=[$21], $f30=[$22], $f31=[$23], $f32=[$24], $f33=[$25], $f34=[$26], $f35=[$27], $f36=[$28], $f37=[$34], $f38=[$35], $f39=[$36], $f40=[$37], $f41=[$38], $f42=[$39], $f43=[$40], $f44=[$41], $f45=[$42], $f46=[$43], $f47=[$44], $f48=[$45], $f49=[$46], $f50=[$47], $f51=[$48], $f52=[$29], $f53=[$30], $f54=[$31], $f55=[$32], $f56=[$33])\n"
-        + "    EnumerableJoinRel(condition=[=($0, $51)], joinType=[inner])\n"
-        + "      EnumerableFilterRel(condition=[=($9, 'San Francisco')])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, customer]])\n"
-        + "      EnumerableJoinRel(condition=[=($6, $20)], joinType=[inner])\n"
-        + "        EnumerableJoinRel(condition=[=($0, $5)], joinType=[inner])\n"
-        + "          EnumerableTableAccessRel(table=[[foodmart2, product_class]])\n"
-        + "          EnumerableFilterRel(condition=[=($2, 'Washington')])\n"
-        + "            EnumerableTableAccessRel(table=[[foodmart2, product]])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, sales_fact_1997]])\n");
+            + "from \"sales_fact_1997\" as s\n"
+            + "  join \"customer\" as c using (\"customer_id\")\n"
+            + "  join \"product\" as p using (\"product_id\")\n"
+            + "  join \"product_class\" as pc using (\"product_class_id\")\n"
+            + "where c.\"city\" = 'San Francisco'\n"
+            + "and p.\"brand_name\" = 'Washington'",
+        "EnumerableProject(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], product_class_id=[$37], product_id0=[$38], brand_name=[$39], product_name=[$40], SKU=[$41], SRP=[$42], gross_weight=[$43], net_weight=[$44], recyclable_package=[$45], low_fat=[$46], units_per_case=[$47], cases_per_pallet=[$48], shelf_width=[$49], shelf_height=[$50], shelf_depth=[$51], product_class_id0=[$52], produc
 t_subcategory=[$53], product_category=[$54], product_department=[$55], product_family=[$56])\n"
+            + "  EnumerableProject($f0=[$49], $f1=[$50], $f2=[$51], $f3=[$52], $f4=[$53], $f5=[$54], $f6=[$55], $f7=[$56], $f8=[$0], $f9=[$1], $f10=[$2], $f11=[$3], $f12=[$4], $f13=[$5], $f14=[$6], $f15=[$7], $f16=[$8], $f17=[$9], $f18=[$10], $f19=[$11], $f20=[$12], $f21=[$13], $f22=[$14], $f23=[$15], $f24=[$16], $f25=[$17], $f26=[$18], $f27=[$19], $f28=[$20], $f29=[$21], $f30=[$22], $f31=[$23], $f32=[$24], $f33=[$25], $f34=[$26], $f35=[$27], $f36=[$28], $f37=[$34], $f38=[$35], $f39=[$36], $f40=[$37], $f41=[$38], $f42=[$39], $f43=[$40], $f44=[$41], $f45=[$42], $f46=[$43], $f47=[$44], $f48=[$45], $f49=[$46], $f50=[$47], $f51=[$48], $f52=[$29], $f53=[$30], $f54=[$31], $f55=[$32], $f56=[$33])\n"
+            + "    EnumerableJoin(condition=[=($0, $51)], joinType=[inner])\n"
+            + "      EnumerableFilter(condition=[=($9, 'San Francisco')])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, customer]])\n"
+            + "      EnumerableJoin(condition=[=($6, $20)], joinType=[inner])\n"
+            + "        EnumerableJoin(condition=[=($0, $5)], joinType=[inner])\n"
+            + "          EnumerableTableScan(table=[[foodmart2, product_class]])\n"
+            + "          EnumerableFilter(condition=[=($2, 'Washington')])\n"
+            + "            EnumerableTableScan(table=[[foodmart2, product]])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, sales_fact_1997]])\n");
   }
 
   /** Plans a 5-table join query on the FoodMart schema. The ideal plan is
    * bushy: store x (customer x (product_class x product x sales)). */
   @Test public void testBushy5() throws Exception {
     checkBushy("select *\n"
-        + "from \"sales_fact_1997\" as s\n"
-        + "  join \"customer\" as c using (\"customer_id\")\n"
-        + "  join \"product\" as p using (\"product_id\")\n"
-        + "  join \"product_class\" as pc using (\"product_class_id\")\n"
-        + "  join \"store\" as st using (\"store_id\")\n"
-        + "where c.\"city\" = 'San Francisco'\n",
-        "EnumerableProjectRel(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], product_class_id=[$37], product_id0=[$38], brand_name=[$39], product_name=[$40], SKU=[$41], SRP=[$42], gross_weight=[$43], net_weight=[$44], recyclable_package=[$45], low_fat=[$46], units_per_case=[$47], cases_per_pallet=[$48], shelf_width=[$49], shelf_height=[$50], shelf_depth=[$51], product_class_id0=[$52], pro
 duct_subcategory=[$53], product_category=[$54], product_department=[$55], product_family=[$56], store_id0=[$57], store_type=[$58], region_id=[$59], store_name=[$60], store_number=[$61], store_street_address=[$62], store_city=[$63], store_state=[$64], store_postal_code=[$65], store_country=[$66], store_manager=[$67], store_phone=[$68], store_fax=[$69], first_opened_date=[$70], last_remodel_date=[$71], store_sqft=[$72], grocery_sqft=[$73], frozen_sqft=[$74], meat_sqft=[$75], coffee_bar=[$76], video_store=[$77], salad_bar=[$78], prepared_food=[$79], florist=[$80])\n"
-        + "  EnumerableProjectRel($f0=[$73], $f1=[$74], $f2=[$75], $f3=[$76], $f4=[$77], $f5=[$78], $f6=[$79], $f7=[$80], $f8=[$24], $f9=[$25], $f10=[$26], $f11=[$27], $f12=[$28], $f13=[$29], $f14=[$30], $f15=[$31], $f16=[$32], $f17=[$33], $f18=[$34], $f19=[$35], $f20=[$36], $f21=[$37], $f22=[$38], $f23=[$39], $f24=[$40], $f25=[$41], $f26=[$42], $f27=[$43], $f28=[$44], $f29=[$45], $f30=[$46], $f31=[$47], $f32=[$48], $f33=[$49], $f34=[$50], $f35=[$51], $f36=[$52], $f37=[$58], $f38=[$59], $f39=[$60], $f40=[$61], $f41=[$62], $f42=[$63], $f43=[$64], $f44=[$65], $f45=[$66], $f46=[$67], $f47=[$68], $f48=[$69], $f49=[$70], $f50=[$71], $f51=[$72], $f52=[$53], $f53=[$54], $f54=[$55], $f55=[$56], $f56=[$57], $f57=[$0], $f58=[$1], $f59=[$2], $f60=[$3], $f61=[$4], $f62=[$5], $f63=[$6], $f64=[$7], $f65=[$8], $f66=[$9], $f67=[$10], $f68=[$11], $f69=[$12], $f70=[$13], $f71=[$14], $f72=[$15], $f73=[$16], $f74=[$17], $f75=[$18], $f76=[$19], $f77=[$20], $f78=[$21], $f79=[$22], $f80=[$23])\n"
-        + "    EnumerableJoinRel(condition=[=($0, $77)], joinType=[inner])\n"
-        + "      EnumerableTableAccessRel(table=[[foodmart2, store]])\n"
-        + "      EnumerableJoinRel(condition=[=($0, $51)], joinType=[inner])\n"
-        + "        EnumerableFilterRel(condition=[=($9, 'San Francisco')])\n"
-        + "          EnumerableTableAccessRel(table=[[foodmart2, customer]])\n"
-        + "        EnumerableJoinRel(condition=[=($6, $20)], joinType=[inner])\n"
-        + "          EnumerableJoinRel(condition=[=($0, $5)], joinType=[inner])\n"
-        + "            EnumerableTableAccessRel(table=[[foodmart2, product_class]])\n"
-        + "            EnumerableTableAccessRel(table=[[foodmart2, product]])\n"
-        + "          EnumerableTableAccessRel(table=[[foodmart2, sales_fact_1997]])\n");
+            + "from \"sales_fact_1997\" as s\n"
+            + "  join \"customer\" as c using (\"customer_id\")\n"
+            + "  join \"product\" as p using (\"product_id\")\n"
+            + "  join \"product_class\" as pc using (\"product_class_id\")\n"
+            + "  join \"store\" as st using (\"store_id\")\n"
+            + "where c.\"city\" = 'San Francisco'\n",
+        "EnumerableProject(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], product_class_id=[$37], product_id0=[$38], brand_name=[$39], product_name=[$40], SKU=[$41], SRP=[$42], gross_weight=[$43], net_weight=[$44], recyclable_package=[$45], low_fat=[$46], units_per_case=[$47], cases_per_pallet=[$48], shelf_width=[$49], shelf_height=[$50], shelf_depth=[$51], product_class_id0=[$52], produc
 t_subcategory=[$53], product_category=[$54], product_department=[$55], product_family=[$56], store_id0=[$57], store_type=[$58], region_id=[$59], store_name=[$60], store_number=[$61], store_street_address=[$62], store_city=[$63], store_state=[$64], store_postal_code=[$65], store_country=[$66], store_manager=[$67], store_phone=[$68], store_fax=[$69], first_opened_date=[$70], last_remodel_date=[$71], store_sqft=[$72], grocery_sqft=[$73], frozen_sqft=[$74], meat_sqft=[$75], coffee_bar=[$76], video_store=[$77], salad_bar=[$78], prepared_food=[$79], florist=[$80])\n"
+            + "  EnumerableProject($f0=[$73], $f1=[$74], $f2=[$75], $f3=[$76], $f4=[$77], $f5=[$78], $f6=[$79], $f7=[$80], $f8=[$24], $f9=[$25], $f10=[$26], $f11=[$27], $f12=[$28], $f13=[$29], $f14=[$30], $f15=[$31], $f16=[$32], $f17=[$33], $f18=[$34], $f19=[$35], $f20=[$36], $f21=[$37], $f22=[$38], $f23=[$39], $f24=[$40], $f25=[$41], $f26=[$42], $f27=[$43], $f28=[$44], $f29=[$45], $f30=[$46], $f31=[$47], $f32=[$48], $f33=[$49], $f34=[$50], $f35=[$51], $f36=[$52], $f37=[$58], $f38=[$59], $f39=[$60], $f40=[$61], $f41=[$62], $f42=[$63], $f43=[$64], $f44=[$65], $f45=[$66], $f46=[$67], $f47=[$68], $f48=[$69], $f49=[$70], $f50=[$71], $f51=[$72], $f52=[$53], $f53=[$54], $f54=[$55], $f55=[$56], $f56=[$57], $f57=[$0], $f58=[$1], $f59=[$2], $f60=[$3], $f61=[$4], $f62=[$5], $f63=[$6], $f64=[$7], $f65=[$8], $f66=[$9], $f67=[$10], $f68=[$11], $f69=[$12], $f70=[$13], $f71=[$14], $f72=[$15], $f73=[$16], $f74=[$17], $f75=[$18], $f76=[$19], $f77=[$20], $f78=[$21], $f79=[$22], $f80=[$23])\n"
+            + "    EnumerableJoin(condition=[=($0, $77)], joinType=[inner])\n"
+            + "      EnumerableTableScan(table=[[foodmart2, store]])\n"
+            + "      EnumerableJoin(condition=[=($0, $51)], joinType=[inner])\n"
+            + "        EnumerableFilter(condition=[=($9, 'San Francisco')])\n"
+            + "          EnumerableTableScan(table=[[foodmart2, customer]])\n"
+            + "        EnumerableJoin(condition=[=($6, $20)], joinType=[inner])\n"
+            + "          EnumerableJoin(condition=[=($0, $5)], joinType=[inner])\n"
+            + "            EnumerableTableScan(table=[[foodmart2, product_class]])\n"
+            + "            EnumerableTableScan(table=[[foodmart2, product]])\n"
+            + "          EnumerableTableScan(table=[[foodmart2, sales_fact_1997]])\n");
   }
 
   /** Tests the bushy join algorithm where one table does not join to
    * anything. */
   @Test public void testBushyCrossJoin() throws Exception {
     checkBushy("select * from \"sales_fact_1997\"\n"
-        + "join \"customer\" using (\"customer_id\")\n"
-        + "cross join \"department\"",
-        "EnumerableProjectRel(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], department_id=[$37], department_description=[$38])\n"
-        + "  EnumerableProjectRel($f0=[$31], $f1=[$32], $f2=[$33], $f3=[$34], $f4=[$35], $f5=[$36], $f6=[$37], $f7=[$38], $f8=[$2], $f9=[$3], $f10=[$4], $f11=[$5], $f12=[$6], $f13=[$7], $f14=[$8], $f15=[$9], $f16=[$10], $f17=[$11], $f18=[$12], $f19=[$13], $f20=[$14], $f21=[$15], $f22=[$16], $f23=[$17], $f24=[$18], $f25=[$19], $f26=[$20], $f27=[$21], $f28=[$22], $f29=[$23], $f30=[$24], $f31=[$25], $f32=[$26], $f33=[$27], $f34=[$28], $f35=[$29], $f36=[$30], $f37=[$0], $f38=[$1])\n"
-        + "    EnumerableJoinRel(condition=[true], joinType=[inner])\n"
-        + "      EnumerableTableAccessRel(table=[[foodmart2, department]])\n"
-        + "      EnumerableJoinRel(condition=[=($0, $31)], joinType=[inner])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, customer]])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, sales_fact_1997]])");
+            + "join \"customer\" using (\"customer_id\")\n"
+            + "cross join \"department\"",
+        "EnumerableProject(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], department_id=[$37], department_description=[$38])\n"
+            + "  EnumerableProject($f0=[$31], $f1=[$32], $f2=[$33], $f3=[$34], $f4=[$35], $f5=[$36], $f6=[$37], $f7=[$38], $f8=[$2], $f9=[$3], $f10=[$4], $f11=[$5], $f12=[$6], $f13=[$7], $f14=[$8], $f15=[$9], $f16=[$10], $f17=[$11], $f18=[$12], $f19=[$13], $f20=[$14], $f21=[$15], $f22=[$16], $f23=[$17], $f24=[$18], $f25=[$19], $f26=[$20], $f27=[$21], $f28=[$22], $f29=[$23], $f30=[$24], $f31=[$25], $f32=[$26], $f33=[$27], $f34=[$28], $f35=[$29], $f36=[$30], $f37=[$0], $f38=[$1])\n"
+            + "    EnumerableJoin(condition=[true], joinType=[inner])\n"
+            + "      EnumerableTableScan(table=[[foodmart2, department]])\n"
+            + "      EnumerableJoin(condition=[=($0, $31)], joinType=[inner])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, customer]])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, sales_fact_1997]])");
   }
 
   /** Tests the bushy join algorithm against a query where not all tables have a
    * join condition to the others. */
   @Test public void testBushyCrossJoin2() throws Exception {
     checkBushy("select * from \"sales_fact_1997\"\n"
-        + "join \"customer\" using (\"customer_id\")\n"
-        + "cross join \"department\"\n"
-        + "join \"employee\" using (\"department_id\")",
-        "EnumerableProjectRel(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], department_id=[$37], department_description=[$38], employee_id=[$39], full_name=[$40], first_name=[$41], last_name=[$42], position_id=[$43], position_title=[$44], store_id0=[$45], department_id0=[$46], birth_date=[$47], hire_date=[$48], end_date=[$49], salary=[$50], supervisor_id=[$51], education_level=[$52], mar
 ital_status0=[$53], gender0=[$54], management_role=[$55])\n"
-        + "  EnumerableProjectRel($f0=[$48], $f1=[$49], $f2=[$50], $f3=[$51], $f4=[$52], $f5=[$53], $f6=[$54], $f7=[$55], $f8=[$19], $f9=[$20], $f10=[$21], $f11=[$22], $f12=[$23], $f13=[$24], $f14=[$25], $f15=[$26], $f16=[$27], $f17=[$28], $f18=[$29], $f19=[$30], $f20=[$31], $f21=[$32], $f22=[$33], $f23=[$34], $f24=[$35], $f25=[$36], $f26=[$37], $f27=[$38], $f28=[$39], $f29=[$40], $f30=[$41], $f31=[$42], $f32=[$43], $f33=[$44], $f34=[$45], $f35=[$46], $f36=[$47], $f37=[$0], $f38=[$1], $f39=[$2], $f40=[$3], $f41=[$4], $f42=[$5], $f43=[$6], $f44=[$7], $f45=[$8], $f46=[$9], $f47=[$10], $f48=[$11], $f49=[$12], $f50=[$13], $f51=[$14], $f52=[$15], $f53=[$16], $f54=[$17], $f55=[$18])\n"
-        + "    EnumerableJoinRel(condition=[true], joinType=[inner])\n"
-        + "      EnumerableJoinRel(condition=[=($0, $9)], joinType=[inner])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, department]])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, employee]])\n"
-        + "      EnumerableJoinRel(condition=[=($0, $31)], joinType=[inner])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, customer]])\n"
-        + "        EnumerableTableAccessRel(table=[[foodmart2, sales_fact_1997]])\n");
+            + "join \"customer\" using (\"customer_id\")\n"
+            + "cross join \"department\"\n"
+            + "join \"employee\" using (\"department_id\")",
+        "EnumerableProject(product_id=[$0], time_id=[$1], customer_id=[$2], promotion_id=[$3], store_id=[$4], store_sales=[$5], store_cost=[$6], unit_sales=[$7], customer_id0=[$8], account_num=[$9], lname=[$10], fname=[$11], mi=[$12], address1=[$13], address2=[$14], address3=[$15], address4=[$16], city=[$17], state_province=[$18], postal_code=[$19], country=[$20], customer_region_id=[$21], phone1=[$22], phone2=[$23], birthdate=[$24], marital_status=[$25], yearly_income=[$26], gender=[$27], total_children=[$28], num_children_at_home=[$29], education=[$30], date_accnt_opened=[$31], member_card=[$32], occupation=[$33], houseowner=[$34], num_cars_owned=[$35], fullname=[$36], department_id=[$37], department_description=[$38], employee_id=[$39], full_name=[$40], first_name=[$41], last_name=[$42], position_id=[$43], position_title=[$44], store_id0=[$45], department_id0=[$46], birth_date=[$47], hire_date=[$48], end_date=[$49], salary=[$50], supervisor_id=[$51], education_level=[$52], marita
 l_status0=[$53], gender0=[$54], management_role=[$55])\n"
+            + "  EnumerableProject($f0=[$48], $f1=[$49], $f2=[$50], $f3=[$51], $f4=[$52], $f5=[$53], $f6=[$54], $f7=[$55], $f8=[$19], $f9=[$20], $f10=[$21], $f11=[$22], $f12=[$23], $f13=[$24], $f14=[$25], $f15=[$26], $f16=[$27], $f17=[$28], $f18=[$29], $f19=[$30], $f20=[$31], $f21=[$32], $f22=[$33], $f23=[$34], $f24=[$35], $f25=[$36], $f26=[$37], $f27=[$38], $f28=[$39], $f29=[$40], $f30=[$41], $f31=[$42], $f32=[$43], $f33=[$44], $f34=[$45], $f35=[$46], $f36=[$47], $f37=[$0], $f38=[$1], $f39=[$2], $f40=[$3], $f41=[$4], $f42=[$5], $f43=[$6], $f44=[$7], $f45=[$8], $f46=[$9], $f47=[$10], $f48=[$11], $f49=[$12], $f50=[$13], $f51=[$14], $f52=[$15], $f53=[$16], $f54=[$17], $f55=[$18])\n"
+            + "    EnumerableJoin(condition=[true], joinType=[inner])\n"
+            + "      EnumerableJoin(condition=[=($0, $9)], joinType=[inner])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, department]])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, employee]])\n"
+            + "      EnumerableJoin(condition=[=($0, $31)], joinType=[inner])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, customer]])\n"
+            + "        EnumerableTableScan(table=[[foodmart2, sales_fact_1997]])\n");
   }
 
   /** Checks that a query returns a particular plan, using a planner with
-   * OptimizeBushyJoinRule enabled. */
+   * MultiJoinOptimizeBushyRule enabled. */
   private void checkBushy(String sql, String expected) throws Exception {
     final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
     final FrameworkConfig config = Frameworks.newConfigBuilder()
         .lex(Lex.ORACLE)
         .defaultSchema(
-            OptiqAssert.addSchema(rootSchema,
-                OptiqAssert.SchemaSpec.CLONE_FOODMART))
+            CalciteAssert.addSchema(rootSchema,
+                CalciteAssert.SchemaSpec.CLONE_FOODMART))
         .traitDefs((List<RelTraitDef>) null)
         .programs(Programs.heuristicJoinOrder(Programs.RULE_SET, true, 2))
         .build();
@@ -710,42 +739,44 @@ public class PlannerTest {
   }
 
   /**
-   * Rule to convert a {@link EnumerableProjectRel} to an
-   * {@link JdbcProjectRel}.
+   * Rule to convert a
+   * {@link org.apache.calcite.adapter.enumerable.EnumerableProject} to an
+   * {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcProject}.
    */
   private class MockJdbcProjectRule extends ConverterRule {
     private MockJdbcProjectRule(JdbcConvention out) {
-      super(EnumerableProjectRel.class, EnumerableConvention.INSTANCE, out,
+      super(EnumerableProject.class, EnumerableConvention.INSTANCE, out,
           "MockJdbcProjectRule");
     }
 
     public RelNode convert(RelNode rel) {
-      final EnumerableProjectRel project = (EnumerableProjectRel) rel;
+      final EnumerableProject project = (EnumerableProject) rel;
 
-      return new JdbcProjectRel(
+      return new JdbcRules.JdbcProject(
           rel.getCluster(),
           rel.getTraitSet().replace(getOutConvention()),
-          convert(project.getChild(),
-              project.getChild().getTraitSet().replace(getOutConvention())),
+          convert(project.getInput(),
+              project.getInput().getTraitSet().replace(getOutConvention())),
           project.getProjects(),
           project.getRowType(),
-          ProjectRelBase.Flags.BOXED);
+          Project.Flags.BOXED);
     }
   }
 
   /**
-   * Rule to convert a {@link JavaRules.EnumerableTableAccessRel} to an
+   * Rule to convert a
+   * {@link org.apache.calcite.adapter.enumerable.EnumerableTableScan} to an
    * {@link MockJdbcTableScan}.
    */
   private class MockJdbcTableRule extends ConverterRule {
     private MockJdbcTableRule(JdbcConvention out) {
-      super(JavaRules.EnumerableTableAccessRel.class,
+      super(EnumerableTableScan.class,
           EnumerableConvention.INSTANCE, out, "MockJdbcTableRule");
     }
 
     public RelNode convert(RelNode rel) {
-      final JavaRules.EnumerableTableAccessRel scan =
-          (JavaRules.EnumerableTableAccessRel) rel;
+      final EnumerableTableScan scan =
+          (EnumerableTableScan) rel;
       return new MockJdbcTableScan(scan.getCluster(),
           scan.getTable(),
           (JdbcConvention) getOutConvention());
@@ -756,7 +787,7 @@ public class PlannerTest {
    * Relational expression representing a "mock" scan of a table in a
    * JDBC data source.
    */
-  private class MockJdbcTableScan extends TableAccessRelBase
+  private class MockJdbcTableScan extends TableScan
       implements JdbcRel {
 
     public MockJdbcTableScan(RelOptCluster cluster, RelOptTable table,
@@ -782,7 +813,7 @@ public class PlannerTest {
   }
 
   /**
-   * Test to determine whether de-correlation correctly removes CorrelatorRel.
+   * Test to determine whether de-correlation correctly removes Correlator.
    */
   @Test public void testOldJoinStyleDeCorrelation() throws Exception {
     assertFalse(
@@ -800,7 +831,7 @@ public class PlannerTest {
             + "    where\n"
             + "      p.`pPartkey` = ps.`psPartkey`\n"
             + "  )\n")
-            .contains("CorrelatorRel"));
+            .contains("Correlator"));
   }
 
   public String checkTpchQuery(String tpchTestQuery) throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/tools/TpchSchema.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/tools/TpchSchema.java b/core/src/test/java/org/apache/calcite/tools/TpchSchema.java
index 5e73e88..be02229 100644
--- a/core/src/test/java/org/apache/calcite/tools/TpchSchema.java
+++ b/core/src/test/java/org/apache/calcite/tools/TpchSchema.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package net.hydromatic.optiq.tools;
+package org.apache.calcite.tools;
 
 /**
  * TPC-H table schema.
@@ -35,8 +35,7 @@ public class TpchSchema {
       this.pPartkey = pPartkey;
     }
 
-    @Override
-    public String toString() {
+    @Override public String toString() {
       return "Part [pPartkey=" + pPartkey + "]";
     }
   }
@@ -54,8 +53,7 @@ public class TpchSchema {
       this.psSupplyCost = psSupplyCost;
     }
 
-    @Override
-    public String toString() {
+    @Override public String toString() {
       return "PartSupp [pSupplyCost=" + psPartkey + ", pSupplyCost="
         + psSupplyCost + "]";
     }

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/BitSetsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/BitSetsTest.java b/core/src/test/java/org/apache/calcite/util/BitSetsTest.java
index 88a6ea9..4e7cdb9 100644
--- a/core/src/test/java/org/apache/calcite/util/BitSetsTest.java
+++ b/core/src/test/java/org/apache/calcite/util/BitSetsTest.java
@@ -14,9 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package net.hydromatic.optiq.util;
-
-import org.eigenbase.util.ImmutableIntList;
+package org.apache.calcite.util;
 
 import com.google.common.collect.Maps;
 
@@ -35,12 +33,12 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 /**
- * Unit test for {@link net.hydromatic.optiq.util.BitSets}.
+ * Unit test for {@link org.apache.calcite.util.BitSets}.
  */
 public class BitSetsTest {
   /**
    * Tests the method
-   * {@link net.hydromatic.optiq.util.BitSets#toIter(java.util.BitSet)}.
+   * {@link org.apache.calcite.util.BitSets#toIter(java.util.BitSet)}.
    */
   @Test public void testToIterBitSet() {
     BitSet bitSet = new BitSet();
@@ -74,7 +72,7 @@ public class BitSetsTest {
 
   /**
    * Tests the method
-   * {@link net.hydromatic.optiq.util.BitSets#toList(java.util.BitSet)}.
+   * {@link org.apache.calcite.util.BitSets#toList(java.util.BitSet)}.
    */
   @Test public void testToListBitSet() {
     BitSet bitSet = new BitSet(10);
@@ -86,7 +84,7 @@ public class BitSetsTest {
   }
 
   /**
-   * Tests the method {@link net.hydromatic.optiq.util.BitSets#of(int...)}.
+   * Tests the method {@link org.apache.calcite.util.BitSets#of(int...)}.
    */
   @Test public void testBitSetOf() {
     assertEquals(
@@ -98,7 +96,7 @@ public class BitSetsTest {
   }
 
   /**
-   * Tests the method {@link net.hydromatic.optiq.util.BitSets#range(int, int)}.
+   * Tests the method {@link org.apache.calcite.util.BitSets#range(int, int)}.
    */
   @Test public void testBitSetsRange() {
     assertEquals(
@@ -114,7 +112,7 @@ public class BitSetsTest {
 
   /**
    * Tests the method
-   * {@link net.hydromatic.optiq.util.BitSets#toArray(java.util.BitSet)}.
+   * {@link org.apache.calcite.util.BitSets#toArray(java.util.BitSet)}.
    */
   @Test public void testBitSetsToArray() {
     int[][] arrays = {{}, {0}, {0, 2}, {1, 65}, {100}};
@@ -125,7 +123,7 @@ public class BitSetsTest {
 
   /**
    * Tests the method
-   * {@link net.hydromatic.optiq.util.BitSets#union(java.util.BitSet, java.util.BitSet...)}.
+   * {@link org.apache.calcite.util.BitSets#union(java.util.BitSet, java.util.BitSet...)}.
    */
   @Test public void testBitSetsUnion() {
     assertThat(BitSets.union(BitSets.of(1), BitSets.of(3)).toString(),
@@ -140,7 +138,7 @@ public class BitSetsTest {
 
   /**
    * Tests the method
-   * {@link net.hydromatic.optiq.util.BitSets#contains(java.util.BitSet, java.util.BitSet)}.
+   * {@link org.apache.calcite.util.BitSets#contains(java.util.BitSet, java.util.BitSet)}.
    */
   @Test public void testBitSetsContains() {
     assertTrue(BitSets.contains(BitSets.range(0, 5), BitSets.range(2, 4)));
@@ -158,7 +156,7 @@ public class BitSetsTest {
 
   /**
    * Tests the method
-   * {@link net.hydromatic.optiq.util.BitSets#of(org.eigenbase.util.ImmutableIntList)}.
+   * {@link org.apache.calcite.util.BitSets#of(ImmutableIntList)}.
    */
   @Test public void testBitSetOfImmutableIntList() {
     ImmutableIntList list = ImmutableIntList.of();
@@ -170,7 +168,7 @@ public class BitSetsTest {
 
   /**
    * Tests the method
-   * {@link net.hydromatic.optiq.util.BitSets#previousClearBit(java.util.BitSet, int)}.
+   * {@link org.apache.calcite.util.BitSets#previousClearBit(java.util.BitSet, int)}.
    */
   @Test public void testPreviousClearBit() {
     assertThat(BitSets.previousClearBit(BitSets.of(), 10), equalTo(10));

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/ChunkListTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/ChunkListTest.java b/core/src/test/java/org/apache/calcite/util/ChunkListTest.java
index 6dfb5a7..0e2bb2d 100644
--- a/core/src/test/java/org/apache/calcite/util/ChunkListTest.java
+++ b/core/src/test/java/org/apache/calcite/util/ChunkListTest.java
@@ -14,16 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.eigenbase.util;
+package org.apache.calcite.util;
 
-import java.util.*;
-
-import net.hydromatic.linq4j.function.Function0;
-import net.hydromatic.linq4j.function.Function1;
+import org.apache.calcite.linq4j.function.Function0;
+import org.apache.calcite.linq4j.function.Function1;
 
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Random;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Unit and performance test for {@link ChunkList}.
@@ -312,9 +323,8 @@ public class ChunkListTest {
         if (size.left > 1000000) {
           continue;
         }
-        new Benchmark(
-            "get from " + size.right + " values, " + (size.left / 1000)
-            + " times, " + pair.right,
+        new Benchmark("get from " + size.right + " values, "
+            + (size.left / 1000) + " times, " + pair.right,
             new Function1<Benchmark.Statistician, Void>() {
               public Void apply(Benchmark.Statistician statistician) {
                 final List<Integer> list = pair.left.apply();

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/PartiallyOrderedSetTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/PartiallyOrderedSetTest.java b/core/src/test/java/org/apache/calcite/util/PartiallyOrderedSetTest.java
index a65d8da..d37c223 100644
--- a/core/src/test/java/org/apache/calcite/util/PartiallyOrderedSetTest.java
+++ b/core/src/test/java/org/apache/calcite/util/PartiallyOrderedSetTest.java
@@ -14,17 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package net.hydromatic.optiq.util;
+package org.apache.calcite.util;
 
-import net.hydromatic.optiq.test.OptiqAssert;
-
-import org.eigenbase.util.TestUtil;
+import org.apache.calcite.test.CalciteAssert;
 
 import org.junit.Test;
 
-import java.util.*;
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeSet;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Unit test for {@link PartiallyOrderedSet}.
@@ -33,7 +38,7 @@ public class PartiallyOrderedSetTest {
   private static final boolean DEBUG = false;
 
   // 100, 250, 1000, 3000 are reasonable
-  private static final int SCALE = OptiqAssert.ENABLE_SLOW ? 250 : 50;
+  private static final int SCALE = CalciteAssert.ENABLE_SLOW ? 250 : 50;
 
   final long seed = new Random().nextLong();
   final Random random = new Random(seed);
@@ -97,7 +102,7 @@ public class PartiallyOrderedSetTest {
     poset.out(buf);
     TestUtil.assertEqualsVerbose(
         "PartiallyOrderedSet size: 0 elements: {\n"
-        + "}",
+            + "}",
         buf.toString());
 
     poset.add("a");
@@ -139,11 +144,11 @@ public class PartiallyOrderedSetTest {
     poset.out(buf);
     TestUtil.assertEqualsVerbose(
         "PartiallyOrderedSet size: 4 elements: {\n"
-        + "  'abcd' parents: [] children: ['ab', 'bcd']\n"
-        + "  'ab' parents: ['abcd'] children: ['']\n"
-        + "  'bcd' parents: ['abcd'] children: ['']\n"
-        + "  '' parents: ['ab', 'bcd'] children: []\n"
-        + "}",
+            + "  'abcd' parents: [] children: ['ab', 'bcd']\n"
+            + "  'ab' parents: ['abcd'] children: ['']\n"
+            + "  'bcd' parents: ['abcd'] children: ['']\n"
+            + "  '' parents: ['ab', 'bcd'] children: []\n"
+            + "}",
         buf.toString());
 
     final String b = "'b'";
@@ -218,7 +223,7 @@ public class PartiallyOrderedSetTest {
   }
 
   @Test public void testDivisorPoset() {
-    if (!OptiqAssert.ENABLE_SLOW) {
+    if (!CalciteAssert.ENABLE_SLOW) {
       return;
     }
     PartiallyOrderedSet<Integer> integers =
@@ -376,13 +381,11 @@ public class PartiallyOrderedSetTest {
   private static Collection<Integer> range(
       final int start, final int end) {
     return new AbstractList<Integer>() {
-      @Override
-      public Integer get(int index) {
+      @Override public Integer get(int index) {
         return start + index;
       }
 
-      @Override
-      public int size() {
+      @Override public int size() {
         return end - start;
       }
     };

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/PermutationTestCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/PermutationTestCase.java b/core/src/test/java/org/apache/calcite/util/PermutationTestCase.java
index 5648a6f..04beeb1 100644
--- a/core/src/test/java/org/apache/calcite/util/PermutationTestCase.java
+++ b/core/src/test/java/org/apache/calcite/util/PermutationTestCase.java
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.eigenbase.util;
+package org.apache.calcite.util;
 
 
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Unit test for {@link Permutation}.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/ReflectVisitorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/ReflectVisitorTest.java b/core/src/test/java/org/apache/calcite/util/ReflectVisitorTest.java
index 12c0fa8..877f446 100644
--- a/core/src/test/java/org/apache/calcite/util/ReflectVisitorTest.java
+++ b/core/src/test/java/org/apache/calcite/util/ReflectVisitorTest.java
@@ -14,17 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.eigenbase.util;
-
-import java.math.*;
+package org.apache.calcite.util;
 
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import java.math.BigDecimal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
- * ReflectVisitorTest tests {@link ReflectUtil#invokeVisitor} and {@link
- * ReflectiveVisitor} and provides a contrived example of how to use them.
+ * ReflectVisitorTest tests {@link ReflectUtil#invokeVisitor} and
+ * {@link ReflectiveVisitor} and provides a contrived example of how to use
+ * them.
  */
 public class ReflectVisitorTest {
   //~ Constructors -----------------------------------------------------------
@@ -138,6 +141,7 @@ public class ReflectVisitorTest {
   public interface FudgeableNumber {
   }
 
+  /** Sub-interface of {@link FudgeableNumber}. */
   public interface DiceyNumber extends FudgeableNumber {
   }
 
@@ -176,8 +180,8 @@ public class ReflectVisitorTest {
 
     /**
      * Negates the given number without using a dispatcher object to cache
-     * applicable methods. The results should be the same as {@link
-     * #negate(Number)}.
+     * applicable methods. The results should be the same as
+     * {@link #negate(Number)}.
      *
      * @param n the number to be negated
      * @return the negated result; not guaranteed to be the same concrete

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/TestUtil.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/TestUtil.java b/core/src/test/java/org/apache/calcite/util/TestUtil.java
index 34dfd6a..769bf75 100644
--- a/core/src/test/java/org/apache/calcite/util/TestUtil.java
+++ b/core/src/test/java/org/apache/calcite/util/TestUtil.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.eigenbase.util;
-
-import java.util.regex.*;
+package org.apache.calcite.util;
 
 import org.junit.ComparisonFailure;
 
+import java.util.regex.Pattern;
+
 /**
  * Static utilities for JUnit tests.
  */
@@ -43,9 +43,7 @@ public abstract class TestUtil {
       if (expected == null) {
         return;
       } else {
-        String message =
-            "Expected:\n"
-            + expected
+        String message = "Expected:\n" + expected
             + "\nActual: null";
         throw new ComparisonFailure(message, expected, null);
       }

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/UtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/UtilTest.java b/core/src/test/java/org/apache/calcite/util/UtilTest.java
index b6bcf00..4ac9cff 100644
--- a/core/src/test/java/org/apache/calcite/util/UtilTest.java
+++ b/core/src/test/java/org/apache/calcite/util/UtilTest.java
@@ -14,29 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.eigenbase.util;
+package org.apache.calcite.util;
 
-import java.io.*;
-import java.lang.management.*;
-import java.math.*;
-import java.sql.Timestamp;
-import java.text.MessageFormat;
-import java.util.*;
-
-import javax.annotation.Nullable;
-
-import org.eigenbase.resource.Resources;
-import org.eigenbase.sql.*;
-import org.eigenbase.sql.util.*;
-import org.eigenbase.test.*;
-
-import net.hydromatic.linq4j.function.Function1;
-
-import net.hydromatic.optiq.runtime.FlatLists;
-import net.hydromatic.optiq.runtime.Spaces;
-import net.hydromatic.optiq.util.BitSets;
-import net.hydromatic.optiq.util.Compatible;
-import net.hydromatic.optiq.util.CompositeMap;
+import org.apache.calcite.linq4j.function.Function1;
+import org.apache.calcite.runtime.FlatLists;
+import org.apache.calcite.runtime.Resources;
+import org.apache.calcite.runtime.Spaces;
+import org.apache.calcite.sql.SqlDialect;
+import org.apache.calcite.sql.util.SqlBuilder;
+import org.apache.calcite.sql.util.SqlString;
+import org.apache.calcite.test.DiffTestCase;
 
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
@@ -48,8 +35,43 @@ import com.google.common.collect.Lists;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.lang.management.MemoryType;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.NavigableSet;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TimeZone;
+import java.util.TreeSet;
+import javax.annotation.Nullable;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.isA;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Unit test for {@link Util} and other classes in this package.
@@ -316,7 +338,7 @@ public class UtilTest {
   }
 
   /**
-   * Tests {@link CastingList} and {@link Util#cast}.
+   * Tests {@link org.apache.calcite.util.CastingList} and {@link Util#cast}.
    */
   @Test public void testCastingList() {
     final List<Number> numberList = new ArrayList<Number>();
@@ -398,16 +420,15 @@ public class UtilTest {
             Arrays.asList(before),
             Arrays.asList(after));
     assertThat(Util.toLinux(diff),
-        equalTo(
-            "1a2\n"
-                + "> (they call her \"Polythene Pam\")\n"
-                + "3c4,5\n"
-                + "< She's the kind of a girl that makes The News of The World\n"
-                + "---\n"
-                + "> She's the kind of a girl that makes The Sunday Times\n"
-                + "> seem more interesting.\n"
-                + "5d6\n"
-                + "< Yeah yeah yeah.\n"));
+        equalTo("1a2\n"
+            + "> (they call her \"Polythene Pam\")\n"
+            + "3c4,5\n"
+            + "< She's the kind of a girl that makes The News of The World\n"
+            + "---\n"
+            + "> She's the kind of a girl that makes The Sunday Times\n"
+            + "> seem more interesting.\n"
+            + "5d6\n"
+            + "< Yeah yeah yeah.\n"));
   }
 
   /**
@@ -469,8 +490,8 @@ public class UtilTest {
   }
 
   /**
-   * Tests the methods {@link Util#enumConstants(Class)} and {@link
-   * Util#enumVal(Class, String)}.
+   * Tests the methods {@link Util#enumConstants(Class)} and
+   * {@link Util#enumVal(Class, String)}.
    */
   @Test public void testEnumConstants() {
     final Map<String, MemoryType> memoryTypeMap =
@@ -494,7 +515,7 @@ public class UtilTest {
    * Tests SQL builders.
    */
   @Test public void testSqlBuilder() {
-    final SqlBuilder buf = new SqlBuilder(SqlDialect.EIGENBASE);
+    final SqlBuilder buf = new SqlBuilder(SqlDialect.CALCITE);
     assertEquals(0, buf.length());
     buf.append("select ");
     assertEquals("select ", buf.getSql());
@@ -507,7 +528,7 @@ public class UtilTest {
     assertEquals("select \"x\", \"y\".\"a b\"", buf.getSql());
 
     final SqlString sqlString = buf.toSqlString();
-    assertEquals(SqlDialect.EIGENBASE, sqlString.getDialect());
+    assertEquals(SqlDialect.CALCITE, sqlString.getDialect());
     assertEquals(buf.getSql(), sqlString.getSql());
 
     assertTrue(buf.getSql().length() > 0);
@@ -533,7 +554,7 @@ public class UtilTest {
   }
 
   /**
-   * Unit test for {@link org.eigenbase.util.CompositeList}.
+   * Unit test for {@link org.apache.calcite.util.CompositeList}.
    */
   @Test public void testCompositeList() {
     // Made up of zero lists
@@ -923,30 +944,6 @@ public class UtilTest {
   }
 
   /**
-   * Unit test for {@link Util#toCamelCase(String)}.
-   */
-  @Test public void testToCamelCase() {
-    assertEquals("myJdbcDriver", Util.toCamelCase("MY_JDBC_DRIVER"));
-    assertEquals("myJdbcDriver", Util.toCamelCase("MY_JDBC__DRIVER"));
-    assertEquals("myJdbcDriver", Util.toCamelCase("my_jdbc_driver"));
-    assertEquals("abCdefGHij", Util.toCamelCase("ab_cdEf_g_Hij"));
-    assertEquals("JdbcDriver", Util.toCamelCase("_JDBC_DRIVER"));
-    assertEquals("", Util.toCamelCase("_"));
-    assertEquals("", Util.toCamelCase(""));
-  }
-
-  /**
-   * Unit test for {@link Util#camelToUpper(String)}.
-   */
-  @Test public void testCamelToUpper() {
-    assertEquals("MY_JDBC_DRIVER", Util.camelToUpper("myJdbcDriver"));
-    assertEquals("MY_J_D_B_C_DRIVER", Util.camelToUpper("myJDBCDriver"));
-    assertEquals("AB_CDEF_G_HIJ", Util.camelToUpper("abCdefGHij"));
-    assertEquals("_JDBC_DRIVER", Util.camelToUpper("JdbcDriver"));
-    assertEquals("", Util.camelToUpper(""));
-  }
-
-  /**
    * Unit test for {@link Util#isDistinct(java.util.List)}.
    */
   @Test public void testDistinct() {
@@ -959,7 +956,7 @@ public class UtilTest {
   }
 
   /**
-   * Unit test for {@link org.eigenbase.util.JsonBuilder}.
+   * Unit test for {@link org.apache.calcite.util.JsonBuilder}.
    */
   @Test public void testJsonBuilder() {
     JsonBuilder builder = new JsonBuilder();
@@ -1196,7 +1193,7 @@ public class UtilTest {
     return set.subSet(s.toUpperCase(), true, s.toLowerCase(), true);
   }
 
-  /** Test for {@link org.eigenbase.util.ImmutableNullableList}. */
+  /** Test for {@link org.apache.calcite.util.ImmutableNullableList}. */
   @Test public void testImmutableNullableList() {
     final List<String> arrayList = Arrays.asList("a", null, "c");
     final List<String> list = ImmutableNullableList.copyOf(arrayList);
@@ -1237,7 +1234,7 @@ public class UtilTest {
         isA((Class) ImmutableList.class));
   }
 
-  /** Test for {@link org.eigenbase.util.UnmodifiableArrayList}. */
+  /** Test for {@link org.apache.calcite.util.UnmodifiableArrayList}. */
   @Test public void testUnmodifiableArrayList() {
     final String[] strings = {"a", null, "c"};
     final List<String> arrayList = Arrays.asList(strings);

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/graph/DirectedGraphTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/graph/DirectedGraphTest.java b/core/src/test/java/org/apache/calcite/util/graph/DirectedGraphTest.java
index 6ff7d35..6724ffc 100644
--- a/core/src/test/java/org/apache/calcite/util/graph/DirectedGraphTest.java
+++ b/core/src/test/java/org/apache/calcite/util/graph/DirectedGraphTest.java
@@ -14,20 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 
 import org.hamcrest.CoreMatchers;
-
 import org.junit.Test;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
 
 import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Unit test for {@link DirectedGraph}.
@@ -172,7 +181,7 @@ public class DirectedGraphTest {
   }
 
   /** Unit test for
-   * {@link net.hydromatic.optiq.util.graph.Graphs.FrozenGraph}. */
+   * {@link org.apache.calcite.util.graph.Graphs.FrozenGraph}. */
   @Test public void testPaths() {
     //       B -> C
     //      /      \
@@ -205,7 +214,7 @@ public class DirectedGraphTest {
     assertEquals("[D, E]", frozenGraph.getShortestPath("D", "E").toString());
   }
 
-  /** Unit test for {@link net.hydromatic.optiq.util.graph.CycleDetector}. */
+  /** Unit test for {@link org.apache.calcite.util.graph.CycleDetector}. */
   @Test public void testCycleDetection() {
     // A - B - C - D
     //  \     /
@@ -276,7 +285,7 @@ public class DirectedGraphTest {
   }
 
   /** Unit test for
-   * {@link net.hydromatic.optiq.util.graph.BreadthFirstIterator}. */
+   * {@link org.apache.calcite.util.graph.BreadthFirstIterator}. */
   @Test public void testBreadthFirstIterator() {
     DefaultDirectedGraph<String, DefaultEdge> graph = createDag();
     final List<String> expected =

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/test/java/org/apache/calcite/util/mapping/MappingTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/mapping/MappingTest.java b/core/src/test/java/org/apache/calcite/util/mapping/MappingTest.java
index 65a9d61..2155294 100644
--- a/core/src/test/java/org/apache/calcite/util/mapping/MappingTest.java
+++ b/core/src/test/java/org/apache/calcite/util/mapping/MappingTest.java
@@ -14,18 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.eigenbase.util.mapping;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+package org.apache.calcite.util.mapping;
 
 import com.google.common.collect.ImmutableMap;
 
 import org.junit.Test;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Unit test for mappings.