@Test // DX-3796 public void testLongRows() throws Exception { List<String> values = new ArrayList<>(); for (int i = 0; i < 100; i++) { values.add(format("%05d", i)); } String row = Joiner.on(",").join(values); String csvTable = genCSVTable("longRows", row, row); test(format("select * from table(%s (type => 'Text', fieldDelimiter => '\t', autoGenerateColumnNames => false, extractHeader => true, skipFirstLine => false))", csvTable), values); } }
@Test public void testUse() throws Exception { File f = genCSVFile("testUse", "{\"columns\": [\"f\",\"g\"]}"); String jsonTableName = format("\"${WORKING_PATH}/%s\"", f.getPath()); // the extension is actually csv test("use dfs"); try { String[] jsonQueries = { format("select columns from table(%s ('JSON'))", jsonTableName), format("select columns from table(%s(type => 'JSON'))", jsonTableName), }; for (String jsonQuery : jsonQueries) { testWithResult(jsonQuery, listOf("f","g")); } testWithResult(format("select length(columns[0]) as columns from table(%s ('JSON'))", jsonTableName), 1); } finally { test("use sys"); } }
@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")); }