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 2015/07/16 20:53:43 UTC

[2/2] incubator-calcite git commit: Remove duplicate resources from XML test reference files

Remove duplicate resources from XML test reference files


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

Branch: refs/heads/master
Commit: 220a085135a0c09798fc330ba73b752af89e92d6
Parents: efecdad
Author: Julian Hyde <jh...@apache.org>
Authored: Thu Jul 16 11:11:35 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Thu Jul 16 11:11:35 2015 -0700

----------------------------------------------------------------------
 .../org/apache/calcite/test/DiffRepository.java | 163 ++++++----
 .../calcite/test/SqlToRelConverterTest.java     |   2 +-
 .../calcite/test/SqlToRelConverterTest.xml      | 312 -------------------
 3 files changed, 98 insertions(+), 379 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/220a0851/core/src/test/java/org/apache/calcite/test/DiffRepository.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/DiffRepository.java b/core/src/test/java/org/apache/calcite/test/DiffRepository.java
index ae06e94..fb6b325 100644
--- a/core/src/test/java/org/apache/calcite/test/DiffRepository.java
+++ b/core/src/test/java/org/apache/calcite/test/DiffRepository.java
@@ -16,6 +16,7 @@
  */
 package org.apache.calcite.test;
 
+import org.apache.calcite.avatica.util.Spaces;
 import org.apache.calcite.util.Util;
 import org.apache.calcite.util.XmlOutput;
 
@@ -36,7 +37,9 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Writer;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -48,24 +51,24 @@ import javax.xml.parsers.ParserConfigurationException;
  * <p>Loads files containing test input and output into memory. If there are
  * differences, writes out a log file containing the actual output.
  *
- * <p>Typical usage is as follows. A testcase class defines a method
+ * <p>Typical usage is as follows. A test case class defines a method
  *
  * <blockquote><pre><code>
  *
  * package com.acme.test;
  *
  * public class MyTest extends TestCase {
- *     public DiffRepository getDiffRepos() {
- *         return DiffRepository.lookup(MyTest.class);
- *     }
+ *   public DiffRepository getDiffRepos() {
+ *     return DiffRepository.lookup(MyTest.class);
+ *   }
  *
- *     &#64;Test public void testToUpper() {
- *          getDiffRepos().assertEquals("${result}", "${string}");
- *     }
+ *   &#64;Test public void testToUpper() {
+ *     getDiffRepos().assertEquals("${result}", "${string}");
+ *   }
  *
- *     &#64;Test public void testToLower() {
- *          getDiffRepos().assertEquals("Multi-line\nstring", "${string}");
- *     }
+ *   &#64;Test public void testToLower() {
+ *     getDiffRepos().assertEquals("Multi-line\nstring", "${string}");
+ *   }
  * }
  * </code></pre></blockquote>
  *
@@ -93,7 +96,7 @@ import javax.xml.parsers.ParserConfigurationException;
  *
  * </code></pre></blockquote>
  *
- * <p>If any of the testcases fails, a log file is generated, called
+ * <p>If any of the test cases fails, a log file is generated, called
  * <code>target/surefire/com/acme/test/MyTest.xml</code>, containing the actual
  * output.</p>
  *
@@ -110,9 +113,9 @@ import javax.xml.parsers.ParserConfigurationException;
  * <blockquote><code>cp target/surefire/com/acme/test/MyTest.xml
  * src/test/resources/com/acme/test/MyTest.xml</code></blockquote>
  *
- * <p>If a resource or testcase does not exist, <code>DiffRepository</code>
+ * <p>If a resource or test case does not exist, <code>DiffRepository</code>
  * creates them in the log file. Because DiffRepository is so forgiving, it is
- * very easy to create new tests and testcases.</p>
+ * very easy to create new tests and test cases.</p>
  *
  * <p>The {@link #lookup} method ensures that all test cases share the same
  * instance of the repository. This is important more than one one test case
@@ -153,16 +156,17 @@ public class DiffRepository {
   private static final String RESOURCE_NAME_ATTR = "name";
 
   /**
-   * Holds one diff-repository per class. It is necessary for all testcases in
-   * the same class to share the same diff-repository: if the repos gets
-   * loaded once per testcase, then only one diff is recorded.
+   * Holds one diff-repository per class. It is necessary for all test cases in
+   * the same class to share the same diff-repository: if the repository gets
+   * loaded once per test case, then only one diff is recorded.
    */
-  private static final Map<Class, DiffRepository> MAP_CLASS_TO_REPOS =
-      new HashMap<Class, DiffRepository>();
+  private static final Map<Class, DiffRepository> MAP_CLASS_TO_REPOSITORY =
+      new HashMap<>();
 
   //~ Instance fields --------------------------------------------------------
 
-  private final DiffRepository baseRepos;
+  private final DiffRepository baseRepository;
+  private final int indent;
   private Document doc;
   private final Element root;
   private final File logFile;
@@ -175,15 +179,15 @@ public class DiffRepository {
    *
    * @param refFile   Reference file
    * @param logFile   Log file
-   * @param baseRepos Parent repository or null
+   * @param baseRepository Parent repository or null
    * @param filter    Filter or null
    */
   private DiffRepository(
       URL refFile,
       File logFile,
-      DiffRepository baseRepos,
+      DiffRepository baseRepository,
       Filter filter) {
-    this.baseRepos = baseRepos;
+    this.baseRepository = baseRepository;
     this.filter = filter;
     if (refFile == null) {
       throw new IllegalArgumentException("url must not be null");
@@ -211,11 +215,12 @@ public class DiffRepository {
         throw new RuntimeException("expected root element of type '" + ROOT_TAG
             + "', but found '" + root.getNodeName() + "'");
       }
-    } catch (ParserConfigurationException e) {
-      throw Util.newInternal(e, "error while creating xml parser");
-    } catch (SAXException e) {
+    } catch (ParserConfigurationException | SAXException e) {
       throw Util.newInternal(e, "error while creating xml parser");
     }
+    indent = logFile.getPath().contains("RelOptRulesTest")
+        || logFile.getPath().contains("SqlToRelConverterTest")
+        || logFile.getPath().contains("SqlLimitsTest") ? 4 : 2;
   }
 
   //~ Methods ----------------------------------------------------------------
@@ -260,7 +265,7 @@ public class DiffRepository {
       // what is in the Java. It helps to have a redundant copy in the
       // resource file.
       final String testCaseName = getCurrentTestCaseName(true);
-      if (baseRepos == null || baseRepos.get(testCaseName, tag) == null) {
+      if (baseRepository == null || baseRepository.get(testCaseName, tag) == null) {
         set(tag, text);
       }
       return text;
@@ -268,7 +273,7 @@ public class DiffRepository {
   }
 
   /**
-   * Sets the value of a given resource of the current testcase.
+   * Sets the value of a given resource of the current test case.
    *
    * @param resourceName Name of the resource, e.g. "sql"
    * @param value        Value of the resource
@@ -288,7 +293,7 @@ public class DiffRepository {
   }
 
   /**
-   * Returns a given resource from a given testcase.
+   * Returns a given resource from a given test case.
    *
    * @param testCaseName Name of test case, e.g. "testFoo"
    * @param resourceName Name of resource, e.g. "sql", "plan"
@@ -299,8 +304,8 @@ public class DiffRepository {
       String resourceName) {
     Element testCaseElement = getTestCaseElement(testCaseName, true);
     if (testCaseElement == null) {
-      if (baseRepos != null) {
-        return baseRepos.get(testCaseName, resourceName);
+      if (baseRepository != null) {
+        return baseRepository.get(testCaseName, resourceName);
       } else {
         return null;
       }
@@ -359,13 +364,13 @@ public class DiffRepository {
         if (testCaseName.equals(
             testCase.getAttribute(TEST_CASE_NAME_ATTR))) {
           if (checkOverride
-              && (baseRepos != null)
-              && (baseRepos.getTestCaseElement(testCaseName, false) != null)
+              && (baseRepository != null)
+              && (baseRepository.getTestCaseElement(testCaseName, false) != null)
               && !"true".equals(
                   testCase.getAttribute(TEST_CASE_OVERRIDES_ATTR))) {
             throw new RuntimeException(
                 "TestCase  '" + testCaseName + "' overrides a "
-                + "testcase in the base repository, but does "
+                + "test case in the base repository, but does "
                 + "not specify 'overrides=true'");
           }
           return testCase;
@@ -376,11 +381,11 @@ public class DiffRepository {
   }
 
   /**
-   * Returns the name of the current testcase by looking up the call stack for
+   * Returns the name of the current test case by looking up the call stack for
    * a method whose name starts with "test", for example "testFoo".
    *
    * @param fail Whether to fail if no method is found
-   * @return Name of current testcase, or null if not found
+   * @return Name of current test case, or null if not found
    */
   private String getCurrentTestCaseName(boolean fail) {
     // REVIEW jvs 12-Mar-2006: Too clever by half.  Someone might not know
@@ -390,7 +395,7 @@ public class DiffRepository {
     // failing here if they forgot?
 
     // Clever, this. Dump the stack and look up it for a method which
-    // looks like a testcase name, e.g. "testFoo".
+    // looks like a test case name, e.g. "testFoo".
     final StackTraceElement[] stackTrace;
     Throwable runtimeException = new Throwable();
     runtimeException.fillInStackTrace();
@@ -402,7 +407,7 @@ public class DiffRepository {
       }
     }
     if (fail) {
-      throw new RuntimeException("no testcase on current callstack");
+      throw new RuntimeException("no test case on current call stack");
     } else {
       return null;
     }
@@ -414,7 +419,7 @@ public class DiffRepository {
     if (expected2 == null) {
       update(testCaseName, expected, actual);
       throw new AssertionError("reference file does not contain resource '"
-          + expected + "' for testcase '" + testCaseName + "'");
+          + expected + "' for test case '" + testCaseName + "'");
     } else {
       try {
         // TODO jvs 25-Apr-2006:  reuse bulk of
@@ -430,6 +435,7 @@ public class DiffRepository {
             tag,
             expected2Canonical,
             actualCanonical);
+        amend(expected, actual);
       } catch (ComparisonFailure e) {
         amend(expected, actual);
         throw e;
@@ -458,7 +464,7 @@ public class DiffRepository {
       root.appendChild(testCaseElement);
     }
     Element resourceElement =
-        getResourceElement(testCaseElement, resourceName);
+        getResourceElement(testCaseElement, resourceName, true);
     if (resourceElement == null) {
       resourceElement = doc.createElement(RESOURCE_TAG);
       resourceElement.setAttribute(RESOURCE_NAME_ATTR, resourceName);
@@ -483,7 +489,7 @@ public class DiffRepository {
       boolean b = logFile.getParentFile().mkdirs();
       Util.discard(b);
       w = new FileWriter(logFile);
-      write(doc, w);
+      write(doc, w, indent);
     } catch (IOException e) {
       throw Util.newInternal(e,
           "error while writing test reference log '" + logFile + "'");
@@ -499,7 +505,7 @@ public class DiffRepository {
   }
 
   /**
-   * Returns a given resource from a given testcase.
+   * Returns a given resource from a given test case.
    *
    * @param testCaseElement The enclosing TestCase element, e.g. <code>
    *                        &lt;TestCase name="testFoo"&gt;</code>.
@@ -509,16 +515,40 @@ public class DiffRepository {
   private static Element getResourceElement(
       Element testCaseElement,
       String resourceName) {
+    return getResourceElement(testCaseElement, resourceName, false);
+  }
+
+  /**
+   * Returns a given resource from a given test case.
+   *
+   * @param testCaseElement The enclosing TestCase element, e.g. <code>
+   *                        &lt;TestCase name="testFoo"&gt;</code>.
+   * @param resourceName    Name of resource, e.g. "sql", "plan"
+   * @param killYoungerSiblings Whether to remove resources with the same
+   *                        name and the same parent that are eclipsed
+   * @return The value of the resource, or null if not found
+   */
+  private static Element getResourceElement(Element testCaseElement,
+      String resourceName, boolean killYoungerSiblings) {
     final NodeList childNodes = testCaseElement.getChildNodes();
+    Element found = null;
+    final List<Node> kills = new ArrayList<>();
     for (int i = 0; i < childNodes.getLength(); i++) {
       Node child = childNodes.item(i);
       if (child.getNodeName().equals(RESOURCE_TAG)
           && resourceName.equals(
               ((Element) child).getAttribute(RESOURCE_NAME_ATTR))) {
-        return (Element) child;
+        if (found == null) {
+          found = (Element) child;
+        } else if (killYoungerSiblings) {
+          kills.add(child);
+        }
       }
     }
-    return null;
+    for (Node kill : kills) {
+      testCaseElement.removeChild(kill);
+    }
+    return found;
   }
 
   private static void removeAllChildren(Element element) {
@@ -534,10 +564,10 @@ public class DiffRepository {
    * <p>FIXME: I'm sure there's a library call to do this, but I'm danged if I
    * can find it. -- jhyde, 2006/2/9.
    */
-  private static void write(Document doc, Writer w) {
+  private static void write(Document doc, Writer w, int indent) {
     final XmlOutput out = new XmlOutput(w);
     out.setGlob(true);
-    out.setIndentString("    ");
+    out.setIndentString(Spaces.of(indent));
     writeNode(doc, out);
   }
 
@@ -634,8 +664,8 @@ public class DiffRepository {
    * Finds the repository instance for a given class, with no base
    * repository or filter.
    *
-   * @param clazz Testcase class
-   * @return The diff repository shared between testcases in this class.
+   * @param clazz Test case class
+   * @return The diff repository shared between test cases in this class.
    */
   public static DiffRepository lookup(Class clazz) {
     return lookup(clazz, null);
@@ -645,28 +675,28 @@ public class DiffRepository {
    * Finds the repository instance for a given class and inheriting from
    * a given repository.
    *
-   * @param clazz     Testcase class
-   * @param baseRepos Base class of test class
-   * @return The diff repository shared between testcases in this class.
+   * @param clazz     Test case class
+   * @param baseRepository Base class of test class
+   * @return The diff repository shared between test cases in this class.
    */
   public static DiffRepository lookup(
       Class clazz,
-      DiffRepository baseRepos) {
-    return lookup(clazz, baseRepos, null);
+      DiffRepository baseRepository) {
+    return lookup(clazz, baseRepository, null);
   }
 
   /**
    * Finds the repository instance for a given class.
    *
-   * <p>It is important that all testcases in a class share the same
-   * repository instance. This ensures that, if two or more testcases fail,
-   * the log file will contains the actual results of both testcases.
+   * <p>It is important that all test cases in a class share the same
+   * repository instance. This ensures that, if two or more test cases fail,
+   * the log file will contains the actual results of both test cases.
    *
-   * <p>The <code>baseRepos</code> parameter is useful if the test is an
+   * <p>The <code>baseRepository</code> parameter is useful if the test is an
    * extension to a previous test. If the test class has a base class which
    * also has a repository, specify the repository here. DiffRepository will
    * look for resources in the base class if it cannot find them in this
-   * repository. If test resources from testcases in the base class are
+   * repository. If test resources from test cases in the base class are
    * missing or incorrect, it will not write them to the log file -- you
    * probably need to fix the base test.
    *
@@ -675,24 +705,25 @@ public class DiffRepository {
    * if the behavior of a derived test is slightly different than a base
    * test. If you do not specify a filter, no filtering will happen.
    *
-   * @param clazz     Testcase class
-   * @param baseRepos Base repository
+   * @param clazz     Test case class
+   * @param baseRepository Base repository
    * @param filter    Filters each string returned by the repository
-   * @return The diff repository shared between testcases in this class.
+   * @return The diff repository shared between test cases in this class.
    */
   public static synchronized DiffRepository lookup(
       Class clazz,
-      DiffRepository baseRepos,
+      DiffRepository baseRepository,
       Filter filter) {
-    DiffRepository diffRepos = MAP_CLASS_TO_REPOS.get(clazz);
-    if (diffRepos == null) {
+    DiffRepository diffRepository = MAP_CLASS_TO_REPOSITORY.get(clazz);
+    if (diffRepository == null) {
       final URL refFile = findFile(clazz, ".xml");
       final File logFile =
           new File(refFile.getFile().replace("test-classes", "surefire"));
-      diffRepos = new DiffRepository(refFile, logFile, baseRepos, filter);
-      MAP_CLASS_TO_REPOS.put(clazz, diffRepos);
+      diffRepository =
+          new DiffRepository(refFile, logFile, baseRepository, filter);
+      MAP_CLASS_TO_REPOSITORY.put(clazz, diffRepository);
     }
-    return diffRepos;
+    return diffRepository;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/220a0851/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 ee7f2c9..3a08601 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
@@ -1132,7 +1132,7 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
    * [CALCITE-753] Test aggregate operators do not derive row types with duplicate column names
    */
   @Test public void testAggNoDuplicateColumnNames() {
-    sql("SELECT empno, EXPR$2, COUNT(empno) FROM (SELECT empno, deptno AS EXPR$2 "
+    sql("SELECT empno, EXPR$2, COUNT(empno) FROM (SELECT empno, deptno AS EXPR$2\n"
             + "FROM emp) GROUP BY empno, EXPR$2").convertsTo("${plan}");
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/220a0851/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
index 1130160..fc9fe91 100644
--- a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
@@ -26,13 +26,6 @@ LogicalProject(EXPR$0=[CASE(=('a', 'a'), 1, null)])
         <Resource name="sql">
             <![CDATA[values (case 'a' when 'a' then 1 end)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$0])
-  ProjectRel(EXPR$0=[CASE(=(_ISO-8859-1'a', _ISO-8859-1'a'), 1, CAST(null):INTEGER)])
-    OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testGroup">
         <Resource name="plan">
@@ -45,14 +38,6 @@ LogicalAggregate(group=[{0}])
         <Resource name="sql">
             <![CDATA[select deptno from emp group by deptno]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(DEPTNO=[$0])
-  AggregateRel(groupCount=[1])
-    ProjectRel($f0=[$7])
-      TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testGroupJustOneAgg">
         <Resource name="plan">
@@ -65,14 +50,6 @@ LogicalAggregate(group=[{0}], SUM_SAL=[SUM($1)])
         <Resource name="sql">
             <![CDATA[select deptno, sum(sal) as sum_sal from emp group by deptno]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(DEPTNO=[$0], EXPR$1=[$1])
-  AggregateRel(groupCount=[1], agg#0=[SUM(1)])
-    ProjectRel($f0=[$7], $f1=[$5])
-      TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testGroupExpressionsInsideAndOut">
         <Resource name="plan">
@@ -86,14 +63,6 @@ LogicalProject(EXPR$0=[+($0, 4)], EXPR$1=[$1], EXPR$2=[$2], EXPR$3=[*(2, $3)])
         <Resource name="sql">
             <![CDATA[select deptno + 4, sum(sal), sum(3 + sal), 2 * count(sal) from emp group by deptno]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[+($0, 4)], EXPR$1=[$1], EXPR$2=[$2], EXPR$3=[*(2, $3)])
-  AggregateRel(groupCount=[1], agg#0=[SUM(1)], agg#1=[SUM(2)], agg#2=[COUNT(1)])
-    ProjectRel($f0=[$7], $f1=[$5], $f2=[+(3, $5)])
-      TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testHaving">
         <Resource name="plan">
@@ -108,15 +77,6 @@ LogicalProject(EXPR$0=[$0])
         <Resource name="sql">
             <![CDATA[select sum(sal + sal) from emp having sum(sal) > 10]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$0])
-  FilterRel(condition=[>($1, 10)])
-    AggregateRel(groupCount=[0], agg#0=[SUM(0)], agg#1=[SUM(1)])
-      ProjectRel($f0=[+($5, $5)], $f1=[$5])
-        TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testGroupBug281">
         <Resource name="plan">
@@ -130,15 +90,6 @@ LogicalProject(NAME=[$0])
         <Resource name="sql">
             <![CDATA[select name from (select name from dept group by name)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(NAME=[$0])
-  ProjectRel(NAME=[$0])
-    AggregateRel(groupCount=[1])
-      ProjectRel($f0=[$1])
-        TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testGroupBug281b">
         <Resource name="plan">
@@ -153,15 +104,6 @@ LogicalProject(NAME=[$1], FOO=[$2])
         <Resource name="sql">
             <![CDATA[select name, foo from (select deptno, name, count(deptno) as foo from dept group by name, deptno, name)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(NAME=[$1], FOO=[$2])
-  ProjectRel(DEPTNO=[$1], NAME=[$0], FOO=[$3])
-    AggregateRel(groupCount=[3], agg#0=[COUNT(1)])
-      ProjectRel($f0=[$1], $f1=[$0], $f2=[$1])
-        TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testAggDistinct">
         <Resource name="plan">
@@ -174,14 +116,6 @@ LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM(DISTINCT $1)], EXPR$
         <Resource name="sql">
             <![CDATA[select deptno, sum(sal), sum(distinct sal), count(*) from emp group by deptno]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[$2], EXPR$3=[$3])
-  AggregateRel(groupCount=[1], agg#0=[SUM(1)], agg#1=[SUM(DISTINCT 1)], agg#2=[COUNT()])
-    ProjectRel($f0=[$7], $f1=[$5])
-      TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testUnnest">
         <Resource name="plan">
@@ -196,19 +130,6 @@ LogicalProject(EXPR$0=[$0])
         <Resource name="sql">
             <![CDATA[select*from unnest(multiset[1,2])]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$0])
-  UncollectRel
-    ProjectRel(EXPR$0=[$SLICE($0)])
-      CollectRel
-        UnionRel(all=[true])
-          ProjectRel(EXPR$0=[1])
-            OneRowRel
-          ProjectRel(EXPR$0=[2])
-            OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testUnnestSubquery">
         <Resource name="plan">
@@ -223,16 +144,6 @@ LogicalProject(DEPTNO=[$0], NAME=[$1])
         <Resource name="sql">
             <![CDATA[select*from unnest(multiset(select*from dept))]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(DEPTNO=[$0], NAME=[$1])
-  UncollectRel
-    ProjectRel(EXPR$0=[$0])
-      CollectRel
-        ProjectRel(DEPTNO=[$0], NAME=[$1])
-          TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testMultisetSubquery">
         <Resource name="plan">
@@ -248,18 +159,6 @@ LogicalProject(EXPR$0=[$1])
         <Resource name="sql">
             <![CDATA[select multiset(select deptno from dept) from (values(true))]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$1])
-  JoinRel(condition=[true], joinType=[inner])
-    ProjectRel(EXPR$0=[$0])
-      ProjectRel(EXPR$0=[true])
-        OneRowRel
-    CollectRel
-      ProjectRel(DEPTNO=[$0])
-        TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testMultiset">
         <Resource name="plan">
@@ -274,17 +173,6 @@ LogicalProject(EXPR$0=['a'], EXPR$1=[$SLICE($2)])
         <Resource name="sql">
             <![CDATA[select 'a',multiset[10] from dept]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[_ISO-8859-1'a'], EXPR$1=[$SLICE($2)])
-  JoinRel(condition=[true], joinType=[inner])
-    TableAccessRel(table=[[SALES, DEPT]])
-    CollectRel
-      UnionRel(all=[true])
-        ProjectRel(EXPR$0=[10])
-          OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testMultisetOfColumns">
         <Resource name="plan">
@@ -303,19 +191,6 @@ LogicalProject(EXPR$0=['abc'], EXPR$1=[$SLICE($9)])
         <Resource name="sql">
             <![CDATA[select 'abc',multiset[deptno,sal] from emp]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[_ISO-8859-1'abc'], EXPR$1=[$SLICE($8)])
-  CorrelatorRel(condition=[true], joinType=[inner], correlations=[[var0=offset7, var1=offset5]])
-    TableAccessRel(table=[[SALES, EMP]])
-    CollectRel
-      UnionRel(all=[true])
-        ProjectRel(EXPR$0=[$cor0.DEPTNO])
-          OneRowRel
-        ProjectRel(EXPR$0=[$cor1.SAL])
-          OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testCorrelationJoin">
         <Resource name="plan">
@@ -332,17 +207,6 @@ LogicalProject(DEPTNO=[$0], NAME=[$1], EMPSET=[$2])
         <Resource name="sql">
             <![CDATA[select *,         multiset(select * from emp where deptno=dept.deptno)                as empset      from dept]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(DEPTNO=[$0], NAME=[$1], EMPSET=[$2])
-  CorrelatorRel(condition=[true], joinType=[inner], correlations=[[var0=offset0]])
-    TableAccessRel(table=[[SALES, DEPT]])
-    CollectRel
-      ProjectRel(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7])
-        FilterRel(condition=[=($7, $cor0.DEPTNO)])
-          TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testExists">
         <Resource name="plan">
@@ -361,18 +225,6 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$
         <Resource name="sql">
             <![CDATA[select*from emp where exists (select 1 from dept where deptno=55)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7])
-  FilterRel(condition=[IS NULL($9)])
-    JoinRel(condition=[true], joinType=[left])
-      TableAccessRel(table=[[SALES, EMP]])
-      ProjectRel(EXPR$0=[$0], $indicator=[true])
-        ProjectRel(EXPR$0=[1])
-          FilterRel(condition=[=($0, 55)])
-            TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testExistsCorrelated">
         <Resource name="plan">
@@ -391,18 +243,6 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$
         <Resource name="sql">
             <![CDATA[select*from emp where exists (select 1 from dept where emp.deptno=dept.deptno)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7])
-  FilterRel(condition=[IS NULL($9)])
-    CorrelatorRel(condition=[true], joinType=[left], correlations=[[var0=offset7]])
-      TableAccessRel(table=[[SALES, EMP]])
-      ProjectRel(EXPR$0=[$0], $indicator=[true])
-        ProjectRel(EXPR$0=[1])
-          FilterRel(condition=[=($cor0.DEPTNO, $0)])
-            TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testUnnestSelect">
         <Resource name="plan">
@@ -421,20 +261,6 @@ LogicalProject(EXPR$0=[$0])
         <Resource name="sql">
             <![CDATA[select*from unnest(select multiset[deptno] from dept)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$0])
-  UncollectRel
-    ProjectRel(EXPR$0=[$0])
-      ProjectRel(EXPR$0=[$SLICE($2)])
-        CorrelatorRel(condition=[true], joinType=[inner], correlations=[[var0=offset0]])
-          TableAccessRel(table=[[SALES, DEPT]])
-          CollectRel
-            UnionRel(all=[true])
-              ProjectRel(EXPR$0=[$cor0.DEPTNO])
-                OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testLateral">
         <Resource name="plan">
@@ -450,16 +276,6 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$
         <Resource name="sql">
             <![CDATA[select * from emp, LATERAL (select * from dept where emp.deptno=dept.deptno)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], DEPTNO0=[$8], NAME=[$9])
-  CorrelatorRel(condition=[true], joinType=[inner], correlations=[[var0=offset7]])
-    TableAccessRel(table=[[SALES, EMP]])
-    ProjectRel(DEPTNO=[$0], NAME=[$1])
-      FilterRel(condition=[=($cor0.DEPTNO, $0)])
-        TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testElement">
         <Resource name="plan">
@@ -474,17 +290,6 @@ LogicalProject(EXPR$0=[ELEMENT($SLICE($9))])
         <Resource name="sql">
             <![CDATA[select element(multiset[5]) from emp]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[ELEMENT($SLICE($8))])
-  JoinRel(condition=[true], joinType=[inner])
-    TableAccessRel(table=[[SALES, EMP]])
-    CollectRel
-      UnionRel(all=[true])
-        ProjectRel(EXPR$0=[5])
-          OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testElementInValues">
         <Resource name="plan">
@@ -497,16 +302,6 @@ LogicalProject(EXPR$0=[ELEMENT($SLICE($0))])
         <Resource name="sql">
             <![CDATA[values element(multiset[5])]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$0])
-  ProjectRel(EXPR$0=[ELEMENT($SLICE($0))])
-    CollectRel
-      UnionRel(all=[true])
-        ProjectRel(EXPR$0=[5])
-          OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testUnionAll">
         <Resource name="plan">
@@ -521,15 +316,6 @@ LogicalUnion(all=[true])
         <Resource name="sql">
             <![CDATA[select empno from emp union all select deptno from dept]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-UnionRel(all=[true])
-  ProjectRel(EMPNO=[$0])
-    TableAccessRel(table=[[SALES, EMP]])
-  ProjectRel(DEPTNO=[$0])
-    TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testUnion">
         <Resource name="plan">
@@ -544,15 +330,6 @@ LogicalUnion(all=[false])
         <Resource name="sql">
             <![CDATA[select empno from emp union select deptno from dept]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-UnionRel(all=[false])
-  ProjectRel(EMPNO=[$0])
-    TableAccessRel(table=[[SALES, EMP]])
-  ProjectRel(DEPTNO=[$0])
-    TableAccessRel(table=[[SALES, DEPT]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testUnionValues">
         <Resource name="plan">
@@ -575,26 +352,6 @@ union all
 select 34 from emp
 union all values (30), (45 + 10)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-UnionRel(all=[true])
-  UnionRel(all=[true])
-    ProjectRel(EXPR$0=[$0])
-      UnionRel(all=[true])
-        ProjectRel(EXPR$0=[10])
-          OneRowRel
-        ProjectRel(EXPR$0=[20])
-          OneRowRel
-    ProjectRel(EXPR$0=[34])
-      TableAccessRel(table=[[SALES, EMP]])
-  ProjectRel(EXPR$0=[$0])
-    UnionRel(all=[true])
-      ProjectRel(EXPR$0=[30])
-        OneRowRel
-      ProjectRel(EXPR$0=[+(45, 10)])
-        OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testUnionSubquery">
         <Resource name="plan">
@@ -618,26 +375,6 @@ LogicalProject(DEPTNO=[$7])
   select deptno from dept where deptno > 20 union all
   values (45), (67))]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(DEPTNO=[$7])
-  JoinRel(condition=[true], joinType=[inner])
-    TableAccessRel(table=[[SALES, EMP]])
-    UnionRel(all=[true])
-      UnionRel(all=[true])
-        ProjectRel(EMPNO=[$0])
-          TableAccessRel(table=[[SALES, EMP]])
-        ProjectRel(DEPTNO=[$0])
-          FilterRel(condition=[>($0, 20)])
-            TableAccessRel(table=[[SALES, DEPT]])
-      ProjectRel(EXPR$0=[$0])
-        UnionRel(all=[true])
-          ProjectRel(EXPR$0=[45])
-            OneRowRel
-          ProjectRel(EXPR$0=[67])
-            OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testIsDistinctFrom">
         <Resource name="plan">
@@ -649,14 +386,6 @@ LogicalProject(EXPR$0=[CAST(CASE(IS NULL(1), IS NOT NULL(2), IS NULL(2), IS NOT
         <Resource name="sql">
             <![CDATA[select 1 is distinct from 2 from (values(true))]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[CASE(IS NULL(1), IS NOT NULL(2), IS NULL(2), IS NOT NULL(1), <>(1, 2))])
-  ProjectRel(EXPR$0=[$0])
-    ProjectRel(EXPR$0=[true])
-      OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testIsNotDistinctFrom">
         <Resource name="plan">
@@ -668,14 +397,6 @@ LogicalProject(EXPR$0=[CAST(CASE(IS NULL(1), IS NULL(2), IS NULL(2), IS NULL(1),
         <Resource name="sql">
             <![CDATA[select 1 is not distinct from 2 from (values(true))]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[CASE(IS NULL(1), IS NULL(2), IS NULL(2), IS NULL(1), =(1, 2))])
-  ProjectRel(EXPR$0=[$0])
-    ProjectRel(EXPR$0=[true])
-      OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testNotLike">
         <Resource name="plan">
@@ -687,13 +408,6 @@ LogicalProject(EXPR$0=[NOT(LIKE('a', 'b', 'c'))])
         <Resource name="sql">
             <![CDATA[values ('a' not like 'b' escape 'c')]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$0])
-  ProjectRel(EXPR$0=[NOT(LIKE(_ISO-8859-1'a', _ISO-8859-1'b', _ISO-8859-1'c'))])
-    OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testOverMultiple">
         <Resource name="plan">
@@ -713,13 +427,6 @@ window w1 as (partition by job order by hiredate rows 2 preceding),
   w2 as (partition by job order by hiredate rows 3 preceding disallow partial),
   w3 as (partition by job order by hiredate range interval '1' second preceding)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[SUM($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING)], EXPR$1=[SUM($7) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING)], EXPR$2=[SUM($7) OVER (PARTITION BY $2 ORDER BY $4 ROWS 3 PRECEDING)])
-  FilterRel(condition=[>(SUM(-($7, $5)) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING), 999)])
-    TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testCharLength">
         <Resource name="plan">
@@ -731,13 +438,6 @@ LogicalProject(EXPR$0=[CHAR_LENGTH('foo')])
         <Resource name="sql">
             <![CDATA[values (character_length('foo'))]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[$0])
-  ProjectRel(EXPR$0=[CHAR_LENGTH(_ISO-8859-1'foo')])
-    OneRowRel
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testOverAvg">
         <Resource name="plan">
@@ -752,12 +452,6 @@ LogicalProject(EXPR$0=[CASE(>(COUNT($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS B
 from emp
 window w1 as (partition by job order by hiredate rows 2 preceding)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[SUM($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING)], EXPR$1=[CASE(=(COUNT($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING), 0), CAST(null):INTEGER, /(SUM($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING), COUNT($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING)))])
-  TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testOverCountStar">
         <Resource name="plan">
@@ -772,12 +466,6 @@ LogicalProject(EXPR$0=[COUNT($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS BETWEEN
 from emp
 window w1 as (partition by job order by hiredate rows 2 preceding)]]>
         </Resource>
-        <Resource name="plan">
-            <![CDATA[
-ProjectRel(EXPR$0=[COUNT($5) OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING)], EXPR$1=[COUNT() OVER (PARTITION BY $2 ORDER BY $4 ROWS 2 PRECEDING)])
-  TableAccessRel(table=[[SALES, EMP]])
-]]>
-        </Resource>
     </TestCase>
     <TestCase name="testIntegerLiteral">
         <Resource name="sql">