@Test public void testMultiLevelRepeatedListEmptyFirst() throws Exception { final String query = "select * from cp.\"vector/complex/multi-repeated-list-empty-first.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf()) .baselineValues(listOf(listOf(listOf(1L), listOf(3L)), listOf(listOf(5L, 7L)))) .baselineValues(listOf(listOf(listOf(2L), listOf(4L)))) .go(); }
@Test public void testMultiLevelRepeatedListEmptyLast() throws Exception { final String query = "select * from cp.\"vector/complex/multi-repeated-list-empty-last.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(listOf(listOf(1L), listOf(3L)), listOf(listOf(5L, 7L)))) .baselineValues(listOf(listOf(listOf(2L), listOf(4L)))) .baselineValues(listOf()) .go(); }
@Test public void testMultiLevelRepeatedListEmptyBetween() throws Exception { final String query = "select * from cp.\"vector/complex/multi-repeated-list-empty-between.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(listOf(listOf(1L), listOf(3L)), listOf(listOf(5L, 7L)))) .baselineValues(listOf()) .baselineValues(listOf(listOf(listOf(2L), listOf(4L)))) .go(); }
@Test public void testDataWithPartOfMultiByteLineDelimiter() throws Exception { String tableName = genCSVTable("testDataWithPartOfMultiByteLineDelimiter", "ab1abc2abc3abc"); testWithResult(format("select columns from table(%s(type=>'TeXT', lineDelimiter => 'abc'))", tableName), listOf("ab1"), listOf("2"), listOf("3")); }
@Test public void testMultiByteLineDelimiter() throws Exception { String tableName = genCSVTable("testMultiByteLineDelimiter", "1abc2abc3abc"); test(format("select columns from table(%s(type=>'TeXT', lineDelimiter => 'abc'))", tableName)); testWithResult(format("select columns from table(%s(type=>'TeXT', lineDelimiter => 'abc'))", tableName), listOf("1"), listOf("2"), listOf("3")); }
@Test public void testTextLineDelimiterWithCarriageReturn() throws Exception { String tableName = genCSVTable("testTextLineDelimiterWithCarriageReturn", "1, a\r", "2, b\r"); testWithResult(format("select columns from table(%s(type=>'TeXT', lineDelimiter => '\r\n'))", tableName), listOf("1, a"), listOf("2, b")); }
@Test public void testTextComment() throws Exception { String commentTableName = genCSVTable("testTextComment", "b|0", "@ this is a comment", "b|1"); testWithResult(format("select columns from table(%s(type => 'TeXT', fieldDelimiter => '|', comment => '@'))", commentTableName), listOf("b", "0"), listOf("b", "1") ); }
@Test public void testRepeatedListEmptyBetween() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-list-empty-between.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(listOf(1L))) .baselineValues(listOf()) .baselineValues(listOf(listOf(2L))) .go(); }
@Test public void testRepeatedListEmptyLast() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-list-empty-last.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(listOf(1L))) .baselineValues(listOf(listOf(2L))) .baselineValues(listOf()) .go(); }
@Test public void testRepeatedListProjectionPastJoin() throws Exception { final String query = "select * from cp.\"join/join-left-drill-3032.json\" f1 inner join cp.\"join/join-right-drill-3032.json\" f2 on f1.id = f2.id"; testBuilder() .sqlQuery(query) .unOrdered() .baselineColumns("id", "id0", "aaa") .baselineValues(1L, 1L, listOf(listOf(listOf("val1"), listOf("val2")))) .go(); }
@Test public void testRepeatedListEmptyFirst() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-list-empty-first.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf()) .baselineValues(listOf(listOf(1L))) .baselineValues(listOf(listOf(2L))) .go(); }
@Test public void testCsvWithoutColumns() throws Exception { String query = String.format("select * from table(dfs_test.\"%s\"(type => 'Text', fieldDelimiter => ','))", root); testBuilder() .sqlQuery(query) .unOrdered() .baselineColumns("columns") .baselineValues(listOf("bmw", "m3", "2010", "", "good", "")) .baselineValues(listOf("bmw", "m5", "2008", "S", "good", "")) .baselineValues(listOf("audi", "s6", "2010", "RS", "bad", "dealer")) .go(); }
@Test public void testRepeatedScalarEmptyFirst() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-scalar-empty-first.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf()) .baselineValues(listOf(1L)) .baselineValues(listOf(2L)) .go(); }
@Test public void testRepeatedScalarEmptyInBetween() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-scalar-empty-between.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(1L)) .baselineValues(listOf()) .baselineValues(listOf(2L)) .go(); }
@Test public void testRepeatedScalarEmptyLast() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-scalar-empty-last.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(1L)) .baselineValues(listOf(2L)) .baselineValues(listOf()) .go(); }
@Test public void testRepeatedMapEmptyLast() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-map-empty-last.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(mapOf("b", 1L))) .baselineValues(listOf(mapOf("b", 2L))) .baselineValues(listOf()) .go(); }
@Test public void testRepeatedMapEmptyBetween() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-map-empty-between.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf(mapOf("b", 1L))) .baselineValues(listOf()) .baselineValues(listOf(mapOf("b", 2L))) .go(); }
@Test public void testRepeatedMapEmptyFirst() throws Exception { final String query = "select * from cp.\"vector/complex/repeated-map-empty-first.json\""; testBuilder() .sqlQuery(query) .ordered() .baselineColumns("a") .baselineValues(listOf()) .baselineValues(listOf(mapOf("b", 1L))) .baselineValues(listOf(mapOf("b", 2L))) .go(); }