use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestImplicitFileColumns method testStarColumnJson.
@Test
public void testStarColumnJson() throws Exception {
final BatchSchema expectedSchema = new SchemaBuilder().addNullable("dir0", TypeProtos.MinorType.VARCHAR).addNullable("id", TypeProtos.MinorType.BIGINT).addNullable("name", TypeProtos.MinorType.VARCHAR).build();
testBuilder().sqlQuery("select * from dfs.`%s` ", JSON_TBL).schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestImplicitFileColumns method testStarColumnCsv.
@Test
public void testStarColumnCsv() throws Exception {
final BatchSchema expectedSchema = new SchemaBuilder().addNullable("dir0", TypeProtos.MinorType.VARCHAR).addNullable("dir1", TypeProtos.MinorType.VARCHAR).addArray("columns", TypeProtos.MinorType.VARCHAR).build();
testBuilder().sqlQuery("select * from dfs.`%s` ", CSV_TBL).schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestParquetMetadataCache method testEmptyDirectoryWithMetadataDirFile.
@Test
public void testEmptyDirectoryWithMetadataDirFile() throws Exception {
final String emptyDirNameWithMetadataFile = "empty_directory";
dirTestWatcher.makeTestTmpSubDir(Paths.get(emptyDirNameWithMetadataFile));
dirTestWatcher.makeTestTmpSubDir(Paths.get(emptyDirNameWithMetadataFile, "t2"));
dirTestWatcher.makeTestTmpSubDir(Paths.get(emptyDirNameWithMetadataFile, "t1"));
dirTestWatcher.copyResourceToTestTmp(Paths.get("parquet", "metadata_files_with_old_versions", "v3_1", "metadata_directories.requires_replace.txt"), Paths.get(emptyDirNameWithMetadataFile, Metadata.METADATA_DIRECTORIES_FILENAME));
final BatchSchema expectedSchema = new SchemaBuilder().build();
testBuilder().sqlQuery("select * from dfs.tmp.`%s`", emptyDirNameWithMetadataFile).schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestParquetMetadataCache method testEmptyDirectoryWithMetadataFile.
@Test
public void testEmptyDirectoryWithMetadataFile() throws Exception {
final String emptyDirNameWithMetadataFile = "empty_directory";
dirTestWatcher.makeTestTmpSubDir(Paths.get(emptyDirNameWithMetadataFile));
dirTestWatcher.copyResourceToTestTmp(Paths.get("parquet", "metadata_files_with_old_versions", "v3_1", "metadata_table.requires_replace.txt"), Paths.get(emptyDirNameWithMetadataFile, Metadata.METADATA_FILENAME));
final BatchSchema expectedSchema = new SchemaBuilder().build();
testBuilder().sqlQuery("select * from dfs.tmp.`%s`", emptyDirNameWithMetadataFile).schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestCsv method testCsvHeadersCaseInsensitive.
// Test fix for DRILL-5590
@Test
public void testCsvHeadersCaseInsensitive() throws IOException {
String fileName = "case2.csv";
buildFile(fileName, validHeaders);
String sql = "SELECT A, b, C FROM `dfs.data`.`%s`";
RowSet actual = client.queryBuilder().sql(sql, fileName).rowSet();
BatchSchema expectedSchema = new SchemaBuilder().add("A", MinorType.VARCHAR).add("b", MinorType.VARCHAR).add("C", MinorType.VARCHAR).build();
assertTrue(expectedSchema.isEquivalent(actual.batchSchema()));
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema).addRow("10", "foo", "bar").build();
new RowSetComparison(expected).verifyAndClearAll(actual);
}
Aggregations