drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject [2/2] drill git commit: DRILL-2094: Test cases added
Date Wed, 29 Apr 2015 03:44:36 GMT
DRILL-2094: Test cases added


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

Branch: refs/heads/master
Commit: 3a232d81e242b4a13f71182fa5e8125a772bae0c
Parents: c3b79ac
Author: Hsuan-Yi Chu <hsuanyi@usc.edu>
Authored: Tue Apr 28 08:16:19 2015 -0700
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Tue Apr 28 20:38:31 2015 -0700

----------------------------------------------------------------------
 .../org/apache/drill/TestExampleQueries.java    | 60 ++++++++++++++++++++
 1 file changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/3a232d81/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
index 138840f..d5c5385 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
@@ -771,4 +771,64 @@ public class TestExampleQueries extends BaseTestQuery{
     .go();
   }
 
+  @Test // DRILL-2094
+  public void testOrderbyArrayElementInSubquery() throws Exception {
+    String root = FileUtils.getResourceAsFile("/store/json/orderByArrayElement.json").toURI().toString();
+
+    String query = String.format("select s.id from \n" +
+        "(select id \n" +
+        "from dfs_test.`%s` \n" +
+        "order by list[0]) s", root);
+
+    testBuilder()
+        .sqlQuery(query)
+        .ordered()
+        .baselineColumns("id")
+        .baselineValues((long) 1)
+        .baselineValues((long) 5)
+        .baselineValues((long) 4)
+        .baselineValues((long) 2)
+        .baselineValues((long) 3)
+        .build().run();
+  }
+
+  @Test // DRILL-1978
+  public void testCTASOrderByCoumnNotInSelectClause() throws Exception {
+    String root = FileUtils.getResourceAsFile("/store/text/data/regions.csv").toURI().toString();
+    String queryCTAS1 = "CREATE TABLE TestExampleQueries_testCTASOrderByCoumnNotInSelectClause1
as " +
+        "select r_name from cp.`tpch/region.parquet` order by r_regionkey;";
+
+    String queryCTAS2 = String.format("CREATE TABLE TestExampleQueries_testCTASOrderByCoumnNotInSelectClause2
as " +
+        "SELECT columns[1] as col FROM dfs_test.`%s` ORDER BY cast(columns[0] as double)",
root);
+
+    String query1 = "select * from TestExampleQueries_testCTASOrderByCoumnNotInSelectClause1";
+    String query2 = "select * from TestExampleQueries_testCTASOrderByCoumnNotInSelectClause2";
+
+    test("use dfs_test.tmp");
+    test(queryCTAS1);
+    test(queryCTAS2);
+
+
+    testBuilder()
+        .sqlQuery(query1)
+        .ordered()
+        .baselineColumns("r_name")
+        .baselineValues("AFRICA")
+        .baselineValues("AMERICA")
+        .baselineValues("ASIA")
+        .baselineValues("EUROPE")
+        .baselineValues("MIDDLE EAST")
+        .build().run();
+
+    testBuilder()
+        .sqlQuery(query2)
+        .ordered()
+        .baselineColumns("col")
+        .baselineValues("AFRICA")
+        .baselineValues("AMERICA")
+        .baselineValues("ASIA")
+        .baselineValues("EUROPE")
+        .baselineValues("MIDDLE EAST")
+        .build().run();
+  }
 }


Mime
View raw message