You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by vo...@apache.org on 2018/06/23 12:55:09 UTC

[1/3] calcite git commit: [CALCITE-2370] Fix failing mongo IT tests when explicit order was not specified (Andrei Sereda)

Repository: calcite
Updated Branches:
  refs/heads/master 6aac57f81 -> 0db06f780


[CALCITE-2370] Fix failing mongo IT tests when explicit order was not specified (Andrei Sereda)

In general, mongo does not guarantee any particular return order of documents without explicit sorting.

Close apache/calcite#738


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

Branch: refs/heads/master
Commit: 3c051474dd86fb14b85df55fd54b869ff5381cb0
Parents: 6aac57f
Author: Andrei Sereda <an...@nospam.com>
Authored: Tue Jun 19 10:00:12 2018 -0400
Committer: Volodymyr Vysotskyi <vv...@gmail.com>
Committed: Sat Jun 23 15:22:06 2018 +0300

----------------------------------------------------------------------
 .../adapter/mongodb/MongoAdapterTest.java       | 62 +++++++++++---------
 1 file changed, 34 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/3c051474/mongodb/src/test/java/org/apache/calcite/adapter/mongodb/MongoAdapterTest.java
----------------------------------------------------------------------
diff --git a/mongodb/src/test/java/org/apache/calcite/adapter/mongodb/MongoAdapterTest.java b/mongodb/src/test/java/org/apache/calcite/adapter/mongodb/MongoAdapterTest.java
index a4061e4..00daf53 100644
--- a/mongodb/src/test/java/org/apache/calcite/adapter/mongodb/MongoAdapterTest.java
+++ b/mongodb/src/test/java/org/apache/calcite/adapter/mongodb/MongoAdapterTest.java
@@ -166,9 +166,9 @@ public class MongoAdapterTest implements SchemaFactory {
     assertModel(MODEL)
             .query("select state, id from zips\n"
                     + "order by state, id offset 2 rows fetch next 3 rows only")
-            .returns("STATE=AK; ID=99801\n"
-                    + "STATE=AL; ID=35215\n"
-                    + "STATE=AL; ID=35401\n")
+            .returnsOrdered("STATE=AK; ID=99801",
+                    "STATE=AL; ID=35215",
+                    "STATE=AL; ID=35401")
             .queryContains(
                     mongoChecker(
                             "{$project: {STATE: '$state', ID: '$_id'}}",
@@ -239,10 +239,11 @@ public class MongoAdapterTest implements SchemaFactory {
                     + "where pop BETWEEN 45000 AND 46000\n"
                     + "order by state desc, pop")
             .limit(4)
-            .returns("CITY=BECKLEY; LONGITUDE=null; LATITUDE=null; POP=45196; STATE=WV; ID=25801\n"
-                    + "CITY=ROCKERVILLE; LONGITUDE=null; LATITUDE=null; POP=45328; STATE=SD; ID=57701\n"
-                    + "CITY=PAWTUCKET; LONGITUDE=null; LATITUDE=null; POP=45442; STATE=RI; ID=02860\n"
-                    + "CITY=LAWTON; LONGITUDE=null; LATITUDE=null; POP=45542; STATE=OK; ID=73505\n");
+            .returnsOrdered(
+                  "CITY=BECKLEY; LONGITUDE=null; LATITUDE=null; POP=45196; STATE=WV; ID=25801",
+                  "CITY=ROCKERVILLE; LONGITUDE=null; LATITUDE=null; POP=45328; STATE=SD; ID=57701",
+                  "CITY=PAWTUCKET; LONGITUDE=null; LATITUDE=null; POP=45442; STATE=RI; ID=02860",
+                  "CITY=LAWTON; LONGITUDE=null; LATITUDE=null; POP=45542; STATE=OK; ID=73505");
   }
 
   @Ignore("broken; [CALCITE-2115] is logged to fix it")
@@ -405,8 +406,8 @@ public class MongoAdapterTest implements SchemaFactory {
     assertModel(MODEL)
             .query("select count(*) from zips group by state order by 1")
             .limit(2)
-            .returns("EXPR$0=2\n"
-                    + "EXPR$0=2\n")
+            .returnsUnordered("EXPR$0=2",
+                    "EXPR$0=2")
             .queryContains(
                     mongoChecker(
                             "{$project: {STATE: '$state'}}",
@@ -420,8 +421,8 @@ public class MongoAdapterTest implements SchemaFactory {
     assertModel(MODEL)
             .query(
                     "select state, count(*) as c from zips group by state order by state")
-            .limit(2)
-            .returns("STATE=AK; C=3\nSTATE=AL; C=3\n")
+            .limit(3)
+            .returns("STATE=AK; C=3\nSTATE=AL; C=3\nSTATE=AR; C=3\n")
             .queryContains(
                     mongoChecker(
                             "{$project: {STATE: '$state'}}",
@@ -594,12 +595,13 @@ public class MongoAdapterTest implements SchemaFactory {
             .query("select state, count(distinct city) as cdc\n"
                     + "from zips\n"
                     + "group by state\n"
-                    + "order by cdc desc limit 5")
-            .returns("STATE=VA; CDC=3\n"
-                    + "STATE=NY; CDC=3\n"
-                    + "STATE=SC; CDC=3\n"
-                    + "STATE=RI; CDC=3\n"
-                    + "STATE=WV; CDC=3\n")
+                    + "order by cdc desc, state\n"
+                    + "limit 5")
+            .returns("STATE=AK; CDC=3\n"
+                    + "STATE=AL; CDC=3\n"
+                    + "STATE=AR; CDC=3\n"
+                    + "STATE=AZ; CDC=3\n"
+                    + "STATE=CA; CDC=3\n")
             .queryContains(
                     mongoChecker(
                             "{$project: {CITY: '$city', STATE: '$state'}}",
@@ -607,7 +609,7 @@ public class MongoAdapterTest implements SchemaFactory {
                             "{$project: {_id: 0, CITY: '$_id.CITY', STATE: '$_id.STATE'}}",
                             "{$group: {_id: '$STATE', CDC: {$sum: {$cond: [ {$eq: ['CITY', null]}, 0, 1]}}}}",
                             "{$project: {STATE: '$_id', CDC: '$CDC'}}",
-                            "{$sort: {CDC: -1}}",
+                            "{$sort: {CDC: -1, STATE: 1}}",
                             "{$limit: 5}"));
   }
 
@@ -628,9 +630,10 @@ public class MongoAdapterTest implements SchemaFactory {
   @Test public void testFilter() {
     assertModel(MODEL)
             .query("select state, city from zips where state = 'CA'")
-            .limit(2)
-            .returns("STATE=CA; CITY=LOS ANGELES\n"
-                    + "STATE=CA; CITY=BELL GARDENS\n")
+            .limit(3)
+            .returnsUnordered("STATE=CA; CITY=LOS ANGELES",
+                      "STATE=CA; CITY=BELL GARDENS",
+                      "STATE=CA; CITY=NORWALK")
             .explainContains("PLAN=MongoToEnumerableConverter\n"
                     + "  MongoProject(STATE=[CAST(ITEM($0, 'state')):VARCHAR(2) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"], CITY=[CAST(ITEM($0, 'city')):VARCHAR(20) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"])\n"
                     + "    MongoFilter(condition=[=(CAST(ITEM($0, 'state')):VARCHAR(2) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\", 'CA')])\n"
@@ -642,15 +645,18 @@ public class MongoAdapterTest implements SchemaFactory {
    * ways around. */
   @Test public void testFilterReversed() {
     assertModel(MODEL)
-            .query("select state, city from zips where 'WI' < state")
-            .limit(2)
-            .returns("STATE=WV; CITY=BECKLEY\nSTATE=WV; CITY=ELM GROVE\n");
+            .query("select state, city from zips where 'WI' < state order by state, city")
+            .limit(3)
+            .returnsOrdered("STATE=WV; CITY=BECKLEY",
+                            "STATE=WV; CITY=ELM GROVE",
+                            "STATE=WV; CITY=STAR CITY");
 
     assertModel(MODEL)
-            .query("select state, city from zips where state > 'WI'")
-            .limit(2)
-            .returns("STATE=WV; CITY=BECKLEY\n"
-                    + "STATE=WV; CITY=ELM GROVE\n");
+            .query("select state, city from zips where state > 'WI' order by state, city")
+            .limit(3)
+            .returnsOrdered("STATE=WV; CITY=BECKLEY",
+                    "STATE=WV; CITY=ELM GROVE",
+                    "STATE=WV; CITY=STAR CITY");
   }
 
   /** MongoDB's predicates are handed (they can only accept literals on the


[2/3] calcite git commit: [CALCITE-2368] Fix misc.iq and scalar.iq quidem unit tests failures on Windows

Posted by vo...@apache.org.
[CALCITE-2368] Fix misc.iq and scalar.iq quidem unit tests failures on Windows

Close apache/calcite#736


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

Branch: refs/heads/master
Commit: 242e12f256d62c72dafcec57cf60f1a5960ac738
Parents: 3c05147
Author: Volodymyr Vysotskyi <vv...@gmail.com>
Authored: Sat Jun 16 17:59:23 2018 +0300
Committer: Volodymyr Vysotskyi <vv...@gmail.com>
Committed: Sat Jun 23 15:22:26 2018 +0300

----------------------------------------------------------------------
 core/src/test/java/org/apache/calcite/test/QuidemTest.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/242e12f2/core/src/test/java/org/apache/calcite/test/QuidemTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/QuidemTest.java b/core/src/test/java/org/apache/calcite/test/QuidemTest.java
index b97318e..05c7a29 100644
--- a/core/src/test/java/org/apache/calcite/test/QuidemTest.java
+++ b/core/src/test/java/org/apache/calcite/test/QuidemTest.java
@@ -72,7 +72,8 @@ public abstract class QuidemTest {
   private Method findMethod(String path) {
     // E.g. path "sql/agg.iq" gives method "testSqlAgg"
     String methodName =
-        AvaticaUtils.toCamelCase("test_" + path.replace('/', '_').replaceAll("\\.iq$", ""));
+        AvaticaUtils.toCamelCase(
+            "test_" + path.replace(File.separatorChar, '_').replaceAll("\\.iq$", ""));
     Method m;
     try {
       m = getClass().getMethod(methodName);


[3/3] calcite git commit: [CALCITE-2369] Fix OsAdapterTest failure on windows (Sergey Nuyanzin)

Posted by vo...@apache.org.
[CALCITE-2369] Fix OsAdapterTest failure on windows (Sergey Nuyanzin)

- Put testDu and testDuFilterSortLimit to ignore in case of Windows

Close apache/calcite#737


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

Branch: refs/heads/master
Commit: 0db06f780e9276424467690c703004df9f012314
Parents: 242e12f
Author: snuyanzin <sn...@gmail.com>
Authored: Mon Jun 18 13:47:04 2018 +0300
Committer: Volodymyr Vysotskyi <vv...@gmail.com>
Committed: Sat Jun 23 15:22:36 2018 +0300

----------------------------------------------------------------------
 .../test/java/org/apache/calcite/adapter/os/OsAdapterTest.java   | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/0db06f78/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
----------------------------------------------------------------------
diff --git a/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java b/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
index 4793f83..1216520 100644
--- a/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
+++ b/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
@@ -90,6 +90,8 @@ public class OsAdapterTest {
   }
 
   @Test public void testDu() {
+    Assume.assumeFalse("Skip: the 'du' table does not work on Windows",
+        isWindows());
     sql("select * from du")
         .returns(
             new Function<ResultSet, Void>() {
@@ -108,6 +110,8 @@ public class OsAdapterTest {
   }
 
   @Test public void testDuFilterSortLimit() {
+    Assume.assumeFalse("Skip: the 'du' table does not work on Windows",
+        isWindows());
     sql("select * from du where path like '%/src/test/java/%'\n"
         + "order by 1 limit 2")
         .returns(