Github user chunhui-shi commented on a diff in the pull request:
https://github.com/apache/drill/pull/518#discussion_r70879554
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/exec/store/json/TestJsonRecordReader.java
---
@@ -159,64 +164,91 @@ public void drill_3353() throws Exception {
test("create table dfs_test.tmp.drill_3353 as select a from
dfs.`${WORKING_PATH}/src/test/resources/jsoninput/drill_3353` where e = true");
String query = "select t.a.d cnt from dfs_test.tmp.drill_3353 t
where t.a.d is not null";
test(query);
- testBuilder()
- .sqlQuery(query)
- .unOrdered()
- .baselineColumns("cnt")
- .baselineValues("1")
- .go();
+ testBuilder().sqlQuery(query).unOrdered().baselineColumns("cnt")
+ .baselineValues("1").go();
} finally {
testNoResult("alter session set `store.json.all_text_mode` = false");
}
}
- @Test // See DRILL-3476
+ @Test
+ // See DRILL-3476
public void testNestedFilter() throws Exception {
String query = "select a from cp.`jsoninput/nestedFilter.json` t where
t.a.b = 1";
String baselineQuery = "select * from cp.`jsoninput/nestedFilter.json`
t where t.a.b = 1";
- testBuilder()
- .sqlQuery(query)
- .unOrdered()
- .sqlBaselineQuery(baselineQuery)
+
testBuilder().sqlQuery(query).unOrdered().sqlBaselineQuery(baselineQuery)
.go();
}
- @Test // See DRILL-4653
-public void testSkippingInvalidJSONRecords() throws Exception {
- try
- {
- String set = "alter session set `" +
ExecConstants.JSON_READER_SKIP_INVALID_RECORDS_FLAG+ "` = true";
- String query = "select count(*) from cp.`jsoninput/DRILL-4653.json`";
+ @Test
+ // See DRILL-4653
+ /* Test for CountingJSONReader */
+ public void testCountingQuerySkippingInvalidJSONRecords() throws
Exception {
+ try {
+ String set = "alter session set `"
+ + ExecConstants.JSON_READER_SKIP_INVALID_RECORDS_FLAG + "` =
true";
+ String set1 = "alter session set `"
+ + ExecConstants.JSON_READER_PRINT_INVALID_RECORDS_LINE_NOS_FLAG
+ + "` = true";
+ String query = "select count(*) from
cp.`jsoninput/drill4653/file.json`";
+ testNoResult(set);
+ testNoResult(set1);
+
testBuilder().unOrdered().sqlQuery(query).sqlBaselineQuery(query).build()
+ .run();
+ } finally {
+ String set = "alter session set `"
+ + ExecConstants.JSON_READER_SKIP_INVALID_RECORDS_FLAG + "` =
false";
testNoResult(set);
- testBuilder()
- .unOrdered()
- .sqlQuery(query)
- .sqlBaselineQuery(query)
- .build().run();
}
- finally
- {
- String set = "alter session set `" +
ExecConstants.JSON_READER_SKIP_INVALID_RECORDS_FLAG+ "` = false";
+ }
+
+ @Test
+ // See DRILL-4653
+ /* Test for CountingJSONReader */
+ public void testCountingQueryNotSkippingInvalidJSONRecords() throws
Exception {
+ try {
+ String query = "select count(*) from
cp.`jsoninput/drill4653/file.json`";
+
testBuilder().unOrdered().sqlQuery(query).sqlBaselineQuery(query).build()
--- End diff --
Should we compare with expected count here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---