You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by pa...@apache.org on 2015/04/25 01:22:41 UTC

[06/11] drill git commit: DRILL-1832: Add unit tests for Json file with null values

DRILL-1832: Add unit tests for Json file with null values


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

Branch: refs/heads/master
Commit: 25ea3e830c1274da2667d222e2833c3dd9699c33
Parents: 319b94c
Author: Parth Chandra <pc...@maprtech.com>
Authored: Fri Apr 17 09:27:58 2015 -0700
Committer: Parth Chandra <pc...@maprtech.com>
Committed: Fri Apr 24 16:21:54 2015 -0700

----------------------------------------------------------------------
 .../exec/store/json/TestJsonRecordReader.java   | 26 +++++++++++-
 .../jsoninput/drill-1832-1-result.json          | 43 ++++++++++++++++++++
 .../jsoninput/drill-1832-2-result.json          |  1 +
 .../test/resources/jsoninput/twitter_43.json    | 43 ++++++++++++++++++++
 4 files changed, 112 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/25ea3e83/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/TestJsonRecordReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/TestJsonRecordReader.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/TestJsonRecordReader.java
index 44e2a2d..27631c3 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/TestJsonRecordReader.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/TestJsonRecordReader.java
@@ -22,7 +22,6 @@ import org.apache.drill.common.exceptions.UserException;
 import org.apache.drill.exec.proto.UserBitShared;
 import org.junit.Test;
 import org.junit.Assert;
-
 import static org.junit.Assert.assertEquals;
 
 
@@ -72,6 +71,7 @@ public class TestJsonRecordReader extends BaseTestQuery{
   public void testEnableAllTextMode() throws Exception {
     testNoResult("alter session set `store.json.all_text_mode`= true");
     test("select * from cp.`jsoninput/big_numeric.json`");
+    testNoResult("alter session set `store.json.all_text_mode`= false");
   }
 
   @Test
@@ -86,4 +86,28 @@ public class TestJsonRecordReader extends BaseTestQuery{
 
   }
 
+  @Test //DRILL-1832
+  public void testJsonWithNulls1() throws Exception {
+
+    final String query="select * from cp.`jsoninput/twitter_43.json`";
+
+    testBuilder()
+            .sqlQuery(query)
+            .unOrdered()
+            .jsonBaselineFile("jsoninput/drill-1832-1-result.json")
+            .go();
+  }
+
+  @Test //DRILL-1832
+  public void testJsonWithNulls2() throws Exception {
+
+    final String query="select SUM(1) as `sum_Number_of_Records_ok` from cp.`/jsoninput/twitter_43.json` having (COUNT(1) > 0)";
+
+    testBuilder()
+            .sqlQuery(query)
+            .unOrdered()
+            .jsonBaselineFile("jsoninput/drill-1832-2-result.json")
+            .go();
+  }
+
 }