use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestBatchSerialization method testMap.
/**
* Tests a map type and an SV2.
*
* @throws IOException
*/
@Test
public void testMap() throws IOException {
BatchSchema schema = new SchemaBuilder().add("top", MinorType.INT).addMap("map").add("key", MinorType.INT).add("value", MinorType.VARCHAR).resumeSchema().build();
verifySerialize(buildMapSet(schema).toIndirect(), buildMapSet(schema));
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestEmptyInputSql method testQueryEmptyCsvH.
/**
* Test select * against empty csv with empty header. * is expanded into empty list of fields.
* @throws Exception
*/
@Test
public void testQueryEmptyCsvH() throws Exception {
final BatchSchema expectedSchema = new SchemaBuilder().build();
testBuilder().sqlQuery("select * from cp.`%s`", SINGLE_EMPTY_CSVH).schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestEmptyInputSql method testQueryConstExprEmptyJson.
/**
* Test with query against an empty file. Select clause has three expressions.
* 1.0 + 100.0 as constant expression, is resolved to required FLOAT8
* cast(100 as varchar(100) is resolved to required varchar(100)
* cast(columns as varchar(100)) is resolved to nullable varchar(100).
*/
@Test
public void testQueryConstExprEmptyJson() throws Exception {
final BatchSchema expectedSchema = new SchemaBuilder().add("key", TypeProtos.MinorType.FLOAT8).add("name", TypeProtos.MinorType.VARCHAR, 100).addNullable("name2", TypeProtos.MinorType.VARCHAR, 100).build();
testBuilder().sqlQuery("select 1.0 + 100.0 as key, " + " cast(100 as varchar(100)) as name, " + " cast(columns as varchar(100)) as name2 " + " from cp.`%s` ", SINGLE_EMPTY_JSON).schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestEmptyInputSql method testEmptyDirectory.
@Test
public void testEmptyDirectory() throws Exception {
final BatchSchema expectedSchema = new SchemaBuilder().build();
testBuilder().sqlQuery("select * from dfs.tmp.`%s`", EMPTY_DIR_NAME).schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.test.rowSet.schema.SchemaBuilder in project drill by axbaretto.
the class TestEmptyInputSql method testQueryMapArrayEmptyJson.
@Test
public void testQueryMapArrayEmptyJson() throws Exception {
final BatchSchema expectedSchema = new SchemaBuilder().addNullable("col1", TypeProtos.MinorType.INT).addNullable("col2", TypeProtos.MinorType.INT).addNullable("col3", TypeProtos.MinorType.INT).build();
testBuilder().sqlQuery("select foo.a.b as col1, foo.columns[2] as col2, foo.bar.columns[3] as col3 from cp.`%s` as foo", SINGLE_EMPTY_JSON).schemaBaseLine(expectedSchema).build().run();
}
Aggregations