use of org.apache.drill.exec.record.BatchSchemaBuilder in project drill by apache.
the class TestHiveStructs method testCorrectColumnOrdering.
// DRILL-7429
@Test
public void testCorrectColumnOrdering() throws Exception {
BatchSchema expectedSchema = new BatchSchemaBuilder().withSchemaBuilder(new SchemaBuilder().addMap("a").resumeSchema().addNullable("b", TypeProtos.MinorType.INT)).build();
String sql = "SELECT t.str_n0 a, rid b FROM hive.struct_tbl t LIMIT 1";
testBuilder().sqlQuery(sql).schemaBaseLine(expectedSchema).go();
}
use of org.apache.drill.exec.record.BatchSchemaBuilder in project drill by apache.
the class TestStarQueries method testSchemaForParallelizedStarOrderBy.
// DRILL-5822
@Test
public void testSchemaForParallelizedStarOrderBy() throws Exception {
String query = "select * from cp.`tpch/region.parquet` order by r_name";
SchemaBuilder schemaBuilder = new SchemaBuilder().add("r_regionkey", TypeProtos.MinorType.INT).add("r_name", TypeProtos.MinorType.VARCHAR).add("r_comment", TypeProtos.MinorType.VARCHAR);
BatchSchema expectedSchema = new BatchSchemaBuilder().withSchemaBuilder(schemaBuilder).build();
testBuilder().sqlQuery(query).optionSettingQueriesForTestQuery("alter session set `planner.slice_target`=1").schemaBaseLine(expectedSchema).build().run();
}
use of org.apache.drill.exec.record.BatchSchemaBuilder in project drill by apache.
the class TestUntypedNull method testCoalesceOnNotExistentColumns.
@Test
public void testCoalesceOnNotExistentColumns() throws Exception {
String query = "select coalesce(unk1, unk2) as coal from cp.`tpch/nation.parquet` limit 5";
SchemaBuilder schemaBuilder = new SchemaBuilder().add("coal", UNTYPED_NULL_TYPE);
BatchSchema expectedSchema = new BatchSchemaBuilder().withSchemaBuilder(schemaBuilder).build();
testBuilder().sqlQuery(query).schemaBaseLine(expectedSchema).go();
testBuilder().sqlQuery(query).unOrdered().baselineColumns("coal").baselineValuesForSingleColumn(null, null, null, null, null).go();
}
use of org.apache.drill.exec.record.BatchSchemaBuilder in project drill by apache.
the class TestUntypedNull method testCoalesceOnNotExistentColumnsWithOrderBy.
@Test
public void testCoalesceOnNotExistentColumnsWithOrderBy() throws Exception {
String query = "select coalesce(unk1, unk2) as coal from cp.`tpch/nation.parquet` order by 1 limit 5";
SchemaBuilder schemaBuilder = new SchemaBuilder().add("coal", UNTYPED_NULL_TYPE);
BatchSchema expectedSchema = new BatchSchemaBuilder().withSchemaBuilder(schemaBuilder).build();
testBuilder().sqlQuery(query).schemaBaseLine(expectedSchema).go();
testBuilder().sqlQuery(query).unOrdered().baselineColumns("coal").baselineValuesForSingleColumn(null, null, null, null, null).go();
}
use of org.apache.drill.exec.record.BatchSchemaBuilder in project drill by apache.
the class AbstractGenericCopierTest method createTestSchema.
protected BatchSchema createTestSchema(BatchSchema.SelectionVectorMode mode) {
MaterializedField colA = MaterializedField.create("colA", Types.required(TypeProtos.MinorType.INT));
MaterializedField colB = MaterializedField.create("colB", Types.required(TypeProtos.MinorType.VARCHAR));
MaterializedField colC = MaterializedField.create("colC", Types.repeated(TypeProtos.MinorType.FLOAT4));
MaterializedField colD = MaterializedField.create("colD", Types.repeated(TypeProtos.MinorType.VARCHAR));
SchemaBuilder schemaBuilder = new SchemaBuilder().add(colA).add(colB).add(colC).add(colD);
return new BatchSchemaBuilder().withSchemaBuilder(schemaBuilder).withSVMode(mode).build();
}
Aggregations