drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject [1/3] drill git commit: DRILL-2268: Added unit tests
Date Wed, 01 Apr 2015 18:41:18 GMT
Repository: drill
Updated Branches:
  refs/heads/master d05ff9d84 -> 767711919


DRILL-2268: Added unit tests


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

Branch: refs/heads/master
Commit: 565c9954f1c5f9580297540583ce41422f65b559
Parents: d05ff9d
Author: Parth Chandra <pchandra@maprtech.com>
Authored: Tue Mar 31 08:52:24 2015 -0700
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Wed Apr 1 11:40:27 2015 -0700

----------------------------------------------------------------------
 .../exec/physical/impl/flatten/TestFlatten.java | 40 ++++++++++++++++++++
 .../resources/complex/drill-2268-1-result.json  |  4 ++
 .../resources/complex/drill-2268-2-result.json  |  4 ++
 .../resources/complex/drill-2268-3-result.json  |  5 +++
 .../resources/complex/json/flatten_join.json    | 18 +++++++++
 5 files changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/565c9954/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
index b9bd99f..6f5a303 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
@@ -305,4 +305,44 @@ public class TestFlatten extends BaseTestQuery {
         .jsonBaselineFile("flatten/drill-2099-result.json")
         .go();
   }
+
+  @Test //DRILL-2268
+  public void testFlattenAfterJoin1() throws Exception {
+    String query = "select flatten(sub1.events) flat_events  from "+
+      "(select t1.events events from cp.`complex/json/flatten_join.json` t1 "+
+      "inner join cp.`complex/json/flatten_join.json` t2 on t1.id=t2.id) sub1";
+
+    testBuilder()
+      .sqlQuery(query)
+      .unOrdered()
+      .jsonBaselineFile("complex/drill-2268-1-result.json")
+      .go();
+  }
+
+  @Test //DRILL-2268
+  public void testFlattenAfterJoin2() throws Exception {
+    String query = "select flatten(t1.events) flat_events from cp.`complex/json/flatten_join.json`
t1 " +
+      "inner join cp.`complex/json/flatten_join.json` t2 on t1.id=t2.id";
+
+    testBuilder()
+      .sqlQuery(query)
+      .unOrdered()
+      .jsonBaselineFile("complex/drill-2268-2-result.json")
+      .go();
+  }
+
+  @Test //DRILL-2268
+  public void testFlattenAfterJoin3() throws Exception {
+    String query = "select flatten(sub1.lst_lst) flat_lst_lst from "+
+      "(select t1.lst_lst lst_lst from cp.`complex/json/flatten_join.json` t1 "+
+      "inner join cp.`complex/json/flatten_join.json` t2 on t1.id=t2.id) sub1";
+
+    testBuilder()
+      .sqlQuery(query)
+      .unOrdered()
+      .jsonBaselineFile("complex/drill-2268-3-result.json")
+      .go();
+  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/565c9954/exec/java-exec/src/test/resources/complex/drill-2268-1-result.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/complex/drill-2268-1-result.json b/exec/java-exec/src/test/resources/complex/drill-2268-1-result.json
new file mode 100644
index 0000000..d7926ce
--- /dev/null
+++ b/exec/java-exec/src/test/resources/complex/drill-2268-1-result.json
@@ -0,0 +1,4 @@
+{flat_events:{"evnt_id":"e1","campaign_id":"c1","event_name":"e1_name","event_time":1000000,"type":"cmpgn9"}}
+{flat_events:{"evnt_id":"e2","campaign_id":"c1","event_name":"e2_name","event_time":2000000,"type":"cmpgn4"}}
+{flat_events:{"evnt_id":"e1","campaign_id":"c1","event_name":"e1_name","event_time":1000000,"type":"cmpgn9"}}
+{flat_events:{"evnt_id":"e2","campaign_id":"c1","event_name":"e2_name","event_time":2000000,"type":"cmpgn4"}}

http://git-wip-us.apache.org/repos/asf/drill/blob/565c9954/exec/java-exec/src/test/resources/complex/drill-2268-2-result.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/complex/drill-2268-2-result.json b/exec/java-exec/src/test/resources/complex/drill-2268-2-result.json
new file mode 100644
index 0000000..d7926ce
--- /dev/null
+++ b/exec/java-exec/src/test/resources/complex/drill-2268-2-result.json
@@ -0,0 +1,4 @@
+{flat_events:{"evnt_id":"e1","campaign_id":"c1","event_name":"e1_name","event_time":1000000,"type":"cmpgn9"}}
+{flat_events:{"evnt_id":"e2","campaign_id":"c1","event_name":"e2_name","event_time":2000000,"type":"cmpgn4"}}
+{flat_events:{"evnt_id":"e1","campaign_id":"c1","event_name":"e1_name","event_time":1000000,"type":"cmpgn9"}}
+{flat_events:{"evnt_id":"e2","campaign_id":"c1","event_name":"e2_name","event_time":2000000,"type":"cmpgn4"}}

http://git-wip-us.apache.org/repos/asf/drill/blob/565c9954/exec/java-exec/src/test/resources/complex/drill-2268-3-result.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/complex/drill-2268-3-result.json b/exec/java-exec/src/test/resources/complex/drill-2268-3-result.json
new file mode 100644
index 0000000..951e46d
--- /dev/null
+++ b/exec/java-exec/src/test/resources/complex/drill-2268-3-result.json
@@ -0,0 +1,5 @@
+{flat_lst_lst:[1,2]}
+{flat_lst_lst:[3,4]}
+{flat_lst_lst:[1,2]}
+{flat_lst_lst:[3,4]}
+

http://git-wip-us.apache.org/repos/asf/drill/blob/565c9954/exec/java-exec/src/test/resources/complex/json/flatten_join.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/complex/json/flatten_join.json b/exec/java-exec/src/test/resources/complex/json/flatten_join.json
new file mode 100644
index 0000000..a0aa528
--- /dev/null
+++ b/exec/java-exec/src/test/resources/complex/json/flatten_join.json
@@ -0,0 +1,18 @@
+{
+      "id" : 1,
+        "events" : [
+                    { "evnt_id":"e1", "campaign_id":"c1", "event_name":"e1_name", "event_time":1000000,
"type" : "cmpgn9"},
+                { "evnt_id":"e2", "campaign_id":"c1", "event_name":"e2_name", "event_time":2000000,
"type" : "cmpgn4"}
+        ],
+              "lst_lst" : [[1,2],[3,4]],
+                "lst" : [1,2,3,4]
+}
+{
+      "id" : 2,
+        "events" : [
+                    { "evnt_id":"e1", "campaign_id":"c1", "event_name":"e1_name", "event_time":1000000,
"type" : "cmpgn9"},
+                { "evnt_id":"e2", "campaign_id":"c1", "event_name":"e2_name", "event_time":2000000,
"type" : "cmpgn4"}
+        ],
+              "lst_lst" : [[1,2],[3,4]],
+                "lst" : [1,2,3,4]
+}


Mime
View raw message