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 2017/11/29 04:09:03 UTC

[4/5] calcite git commit: [CALCITE-2005] Test failures on Windows

[CALCITE-2005] Test failures on Windows


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

Branch: refs/heads/branch-1.15
Commit: 9bb54006aa5cfd7765f791ccaef5e25afacaed86
Parents: dad5818
Author: Julian Hyde <jh...@apache.org>
Authored: Tue Oct 10 10:14:37 2017 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Tue Nov 28 10:23:37 2017 -0800

----------------------------------------------------------------------
 .../org/apache/calcite/interpreter/Interpreter.java     |  3 ++-
 .../java/org/apache/calcite/test/CalciteAssert.java     |  1 +
 .../java/org/apache/calcite/test/RelMetadataTest.java   | 12 ++++++++++++
 .../src/test/java/org/apache/calcite/util/UtilTest.java |  2 +-
 file/pom.xml                                            |  6 ++++++
 .../org/apache/calcite/adapter/file/FileReaderTest.java |  4 +++-
 6 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/9bb54006/core/src/main/java/org/apache/calcite/interpreter/Interpreter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/interpreter/Interpreter.java b/core/src/main/java/org/apache/calcite/interpreter/Interpreter.java
index 2d754fa..9360294 100644
--- a/core/src/main/java/org/apache/calcite/interpreter/Interpreter.java
+++ b/core/src/main/java/org/apache/calcite/interpreter/Interpreter.java
@@ -326,7 +326,8 @@ public class Interpreter extends AbstractEnumerable<Object[]>
       this.rel = rel;
       this.sink = sink;
       this.rowEnumerable = rowEnumerable;
-      assert (sink != null) != (rowEnumerable != null) : "one or the other";
+      Preconditions.checkArgument((sink == null) != (rowEnumerable == null),
+          "one or the other");
     }
   }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/9bb54006/core/src/test/java/org/apache/calcite/test/CalciteAssert.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/CalciteAssert.java b/core/src/test/java/org/apache/calcite/test/CalciteAssert.java
index 06e351a..70a415b 100644
--- a/core/src/test/java/org/apache/calcite/test/CalciteAssert.java
+++ b/core/src/test/java/org/apache/calcite/test/CalciteAssert.java
@@ -1343,6 +1343,7 @@ public class CalciteAssert {
             hooks, checker, null, null);
         return this;
       } catch (Exception e) {
+        e.printStackTrace();
         throw new RuntimeException(
             "exception while executing [" + sql + "]", e);
       }

http://git-wip-us.apache.org/repos/asf/calcite/blob/9bb54006/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
index a09de16..09c8a50 100644
--- a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
@@ -100,9 +100,12 @@ import com.google.common.collect.Sets;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.CustomTypeSafeMatcher;
 import org.hamcrest.Matcher;
+import org.hamcrest.core.Is;
+import org.junit.Assume;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import java.io.File;
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -1444,6 +1447,15 @@ public class RelMetadataTest extends SqlToRelTestBase {
    * columns</a>. Since this is a performance problem, the test result does not
    * change, but takes over 15 minutes before the fix and 6 seconds after. */
   @Test(timeout = 20_000) public void testPullUpPredicatesForExprsItr() {
+    // If we're running Windows, we are probably in a VM and the test may
+    // exceed timeout by a small margin.
+    Assume.assumeThat("Too slow on Windows", File.separatorChar, Is.is('/'));
+    testPullUpPredicatesForExprsItrNoTimeout();
+  }
+
+  /** As {@link #testPullUpPredicatesForExprsItr} but no timeout; can run on
+   * all platforms, even slow VMs. */
+  @Test public void testPullUpPredicatesForExprsItrNoTimeout() {
     final String sql = "select a.EMPNO, a.ENAME\n"
         + "from (select * from sales.emp ) a\n"
         + "join (select * from sales.emp  ) b\n"

http://git-wip-us.apache.org/repos/asf/calcite/blob/9bb54006/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 d7053c9..1fe2d22 100644
--- a/core/src/test/java/org/apache/calcite/util/UtilTest.java
+++ b/core/src/test/java/org/apache/calcite/util/UtilTest.java
@@ -2042,7 +2042,7 @@ public class UtilTest {
         + "\t\t\tline 4 with no ending\n"
         + "\t</someText>\n"
         + "</root>\n";
-    assertThat(s, is(expected));
+    assertThat(Util.toLinux(s), is(expected));
   }
 }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/9bb54006/file/pom.xml
----------------------------------------------------------------------
diff --git a/file/pom.xml b/file/pom.xml
index 6ea7f08..17a6a1e 100644
--- a/file/pom.xml
+++ b/file/pom.xml
@@ -41,6 +41,12 @@ limitations under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-linq4j</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/calcite/blob/9bb54006/file/src/test/java/org/apache/calcite/adapter/file/FileReaderTest.java
----------------------------------------------------------------------
diff --git a/file/src/test/java/org/apache/calcite/adapter/file/FileReaderTest.java b/file/src/test/java/org/apache/calcite/adapter/file/FileReaderTest.java
index ec1034f..a9118f1 100644
--- a/file/src/test/java/org/apache/calcite/adapter/file/FileReaderTest.java
+++ b/file/src/test/java/org/apache/calcite/adapter/file/FileReaderTest.java
@@ -18,6 +18,7 @@ package org.apache.calcite.adapter.file;
 
 import org.apache.calcite.util.Source;
 import org.apache.calcite.util.Sources;
+import org.apache.calcite.util.TestUtil;
 
 import org.jsoup.select.Elements;
 
@@ -200,6 +201,7 @@ public class FileReaderTest {
    * NPE in planner</a>. */
   @Test public void testCsvFile() throws Exception {
     Properties info = new Properties();
+    final String path = resourcePath("sales-csv");
     final String model = "inline:"
         + "{\n"
         + "  \"version\": \"1.0\",\n"
@@ -210,7 +212,7 @@ public class FileReaderTest {
         + "      \"type\": \"custom\",\n"
         + "      \"factory\": \"org.apache.calcite.adapter.file.FileSchemaFactory\",\n"
         + "      \"operand\": {\n"
-        + "        \"directory\": \"" + resourcePath("sales-csv") + "\"\n"
+        + "        \"directory\": " + TestUtil.escapeString(path) + "\n"
         + "      }\n"
         + "    }\n"
         + "  ]\n"