@Test public void topN() throws Exception { String query = String.format("select * from %s order by amount limit 5", DATAFILE); testBuilder() .sqlQuery(query) .ordered() .jsonBaselineFile("store/parquet/complex/baseline_sorted.json") .build() .run(); }
@Test public void sort() throws Exception { String query = String.format("select * from %s order by amount", DATAFILE); testBuilder() .sqlQuery(query) .ordered() .jsonBaselineFile("store/parquet/complex/baseline_sorted.json") .build() .run(); }
@Test public void selectAllColumns() throws Exception { String query = String.format("select amount, \"date\", marketing_info, \"time\", trans_id, trans_info, user_info from %s", DATAFILE); testBuilder() .sqlQuery(query) .ordered() .jsonBaselineFile("store/parquet/complex/baseline.json") .build() .run(); }
@Test public void mergeJoin() throws Exception{ test("alter session set \"planner.enable_hashjoin\" = false"); test("alter session set \"planner.enable_mergejoin\" = true"); String query = String.format("select t1.amount, t1.\"date\", t1.marketing_info, t1.\"time\", t1.trans_id, t1.trans_info, t1.user_info " + "from %s t1, %s t2 where t1.amount = t2.amount", DATAFILE, DATAFILE); testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("store/parquet/complex/baseline.json") .build() .run(); test("alter session set \"planner.enable_mergejoin\" = false"); }
@Test public void testBasicJSON() throws Exception { testBuilder() .sqlQuery("select * from cp.\"scan_json_test_3.json\"") .ordered() .jsonBaselineFile("/scan_json_test_3.json") .build().run(); testBuilder() .sqlQuery("select * from cp.\"scan_json_test_3.json\"") .unOrdered() // Check other verification method with same files .jsonBaselineFile("/scan_json_test_3.json") .build().run(); }
@Test // DRILL-2771, similar problem as DRILL-2197 except problem reproduces with right outer join instead of left @Ignore public void testRightJoinWithMap() throws Exception { final String query = " select a.id, b.oooi.oa.oab.oabc oabc, b.ooof.oa.oab oab from " + "cp.\"join/complex_1.json\" b right outer join cp.\"join/complex_1.json\" a on a.id = b.id order by a.id"; testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("join/DRILL-2197-result-1.json") .build() .run(); } @Test
@Test //DRILL-2163 public void testNestedTypesPastJoinReportsValidResult() throws Exception { final String query = "select t1.uid, t1.events, t1.events[0].evnt_id as event_id, t2.transactions, " + "t2.transactions[0] as trans, t1.odd, t2.even from cp.\"project/complex/a.json\" t1, " + "cp.\"project/complex/b.json\" t2 where t1.uid = t2.uid"; testBuilder() .sqlQuery(query) .ordered() .jsonBaselineFile("project/complex/drill-2163-result.json") .build() .run(); }
@Test public void selectMap() throws Exception { String query = "select marketing_info from cp.\"store/parquet/complex/complex.parquet\""; testBuilder() .sqlQuery(query) .ordered() .jsonBaselineFile("store/parquet/complex/baseline5.json") .build() .run(); }
@Test public void hashJoin() throws Exception{ String query = String.format("select t1.amount, t1.\"date\", t1.marketing_info, t1.\"time\", t1.trans_id, t1.trans_info, t1.user_info " + "from %s t1, %s t2 where t1.amount = t2.amount", DATAFILE, DATAFILE); testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("store/parquet/complex/baseline.json") .build() .run(); }
@Test //DRILL-2254 public void testSingleFlattenFromNestedRepeatedList() throws Exception { final String query = "select t.uid, flatten(t.odd) odd from cp.\"project/complex/a.json\" t"; testPlanSubstrPatterns(query, new String[] {"columns=[`odd`, `uid`]"}, null); testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("flatten/drill-2254-result-single.json") .build() .run(); }
@Test public void testMapOrdering() throws Exception { testBuilder() .sqlQuery("select * from cp.\"/testframework/map_reordering.json\"") .unOrdered() .jsonBaselineFile("testframework/map_reordering2.json") .build().run(); }
@Test public void selectMultiElements() throws Exception { String query = "select t.marketing_info.camp_id as camp_id, t.marketing_info.keywords as keywords from cp.\"store/parquet/complex/complex.parquet\" t"; testBuilder() .sqlQuery(query) .ordered() .jsonBaselineFile("store/parquet/complex/baseline7.json") .build() .run(); }
@Test //DRILL-2197 Left Join with complex type in projection @Ignore("enable union type") public void testLeftHashJoinWithMap() throws Exception { final String query = " select a.id, b.oooi.oa.oab.oabc oabc, b.ooof.oa.oab oab from cp.\"join/complex_1.json\" a left outer join cp.\"join/complex_2.json\" b on a.id=b.id order by a.id"; testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("join/DRILL-2197-result-2.json") .build() .run(); }
@Test //DRILL-2254 supplementary public void testMultiFlattenFromNestedRepeatedList() throws Exception { final String query = "select t.uid, flatten(flatten(t.odd)) odd from cp.\"project/complex/a.json\" t"; testPlanSubstrPatterns(query, new String[] {"columns=[`odd`, `uid`]"}, null); testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("flatten/drill-2254-result-multi.json") .build() .run(); printResult(testRunAndReturn(QueryType.SQL, query)); }
@Test @Ignore("DRILL-1824") public void schemaChangeValidate() throws Exception { testBuilder() // .sqlQuery("select b from dfs.\"${WORKING_PATH}/src/test/resources/vector/complex/writer/schemaChange/\"") // .unOrdered() // .jsonBaselineFile("/vector/complex/writer/expected.json") // .build() .run(); }
@Test public void test() throws Exception { testNoResult("CREATE TABLE pdfs.test_table AS SELECT * FROM cp.\"employees.json\""); testBuilder() .sqlQuery("SELECT * FROM pdfs.test_table") .ordered() .jsonBaselineFile("employees.json") .build() .run(); testNoResult("DROP TABLE pdfs.test_table"); } }
@Test public void testStar() throws Exception { testBuilder() .sqlQuery("select * from cp.\"store/parquet/complex/complex.parquet\"") .ordered() .jsonBaselineFile("store/parquet/complex/baseline.json") .build() .run(); }
@Test public void selectMapAndElements() throws Exception { String query = "select marketing_info, t.marketing_info.camp_id as camp_id, t.marketing_info.keywords[2] as keyword2 from cp.\"store/parquet/complex/complex.parquet\" t"; testBuilder() .sqlQuery(query) .ordered() .jsonBaselineFile("store/parquet/complex/baseline6.json") .build() .run(); }
@Test //DRILL-2197 Left Self Join with complex type in projection @Ignore public void testLeftSelfHashJoinWithMap() throws Exception { final String query = " select a.id, b.oooi.oa.oab.oabc oabc, b.ooof.oa.oab oab from cp.\"join/complex_1.json\" a left outer join cp.\"join/complex_1.json\" b on a.id=b.id order by a.id"; testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("join/DRILL-2197-result-1.json") .build() .run(); }
@Test //DRILL-2254 supplementary public void testSingleMultiFlattenFromNestedRepeatedList() throws Exception { final String query = "select t.uid, flatten(t.odd) once, flatten(flatten(t.odd)) twice from cp.\"project/complex/a.json\" t"; testPlanSubstrPatterns(query, new String[] {"columns=[`odd`, `uid`]"}, null); testBuilder() .sqlQuery(query) .unOrdered() .jsonBaselineFile("flatten/drill-2254-result-mix.json") .build() .run(); }