use of org.apache.drill.exec.physical.config.Filter in project drill by apache.
the class TestNullInputMiniPlan method testUnionFilterAll.
@Test
public void testUnionFilterAll() throws Exception {
List<String> leftJsonBatches = Lists.newArrayList("[{\"a\": 5, \"b\" : \"name1\" }]");
List<String> rightJsonBatches = Lists.newArrayList("[{\"a\": 50, \"b\" : \"name2\" }]");
RecordBatch leftScan = new JsonScanBuilder().jsonBatches(leftJsonBatches).columnsToRead("a", "b").build();
RecordBatch leftFilter = new PopBuilder().physicalOperator(new Filter(null, parseExpr("a < 0"), 1.0f)).addInput(leftScan).build();
RecordBatch rightScan = new JsonScanBuilder().jsonBatches(rightJsonBatches).columnsToRead("a", "b").build();
RecordBatch rightFilter = new PopBuilder().physicalOperator(new Filter(null, parseExpr("a < 0"), 1.0f)).addInput(rightScan).build();
RecordBatch batch = new PopBuilder().physicalOperator(// Children list is provided through RecordBatch
new UnionAll(Collections.emptyList())).addInput(leftFilter).addInput(rightFilter).build();
SchemaBuilder schemaBuilder = new SchemaBuilder().addNullable("a", TypeProtos.MinorType.BIGINT).addNullable("b", TypeProtos.MinorType.VARCHAR);
BatchSchema expectedSchema = new BatchSchemaBuilder().withSchemaBuilder(schemaBuilder).withSVMode(BatchSchema.SelectionVectorMode.NONE).build();
new MiniPlanTestBuilder().root(batch).expectSchema(expectedSchema).expectZeroRow(true).go();
}
use of org.apache.drill.exec.physical.config.Filter in project drill by apache.
the class TestNullInputMiniPlan method testFilterEmpty.
@Test
public void testFilterEmpty() throws Exception {
final PhysicalOperator filter = new Filter(null, parseExpr("a=5"), 1.0f);
testSingleInputNullBatchHandling(filter);
}
use of org.apache.drill.exec.physical.config.Filter in project drill by apache.
the class BasicPhysicalOpUnitTest method testFilter.
@Test
public void testFilter() {
Filter filterConf = new Filter(null, parseExpr("a=5"), 1.0f);
List<String> inputJsonBatches = Lists.newArrayList("[{\"a\": 5, \"b\" : 1 }]", "[{\"a\": 5, \"b\" : 5},{\"a\": 3, \"b\" : 8}]", "[{\"a\": 40, \"b\" : 3},{\"a\": 13, \"b\" : 100}]");
legacyOpTestBuilder().physicalOperator(filterConf).inputDataStreamJson(inputJsonBatches).baselineColumns("a", "b").baselineValues(5l, 1l).baselineValues(5l, 5l).go();
}
use of org.apache.drill.exec.physical.config.Filter in project drill by axbaretto.
the class FilterPrel method getPhysicalOperator.
@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
Prel child = (Prel) this.getInput();
PhysicalOperator childPOP = child.getPhysicalOperator(creator);
Filter p = new Filter(childPOP, getFilterExpression(new DrillParseContext(PrelUtil.getSettings(getCluster()))), 1.0f);
return creator.addMetadata(this, p);
}
use of org.apache.drill.exec.physical.config.Filter in project drill by axbaretto.
the class BasicPhysicalOpUnitTest method testFilter.
@Test
public void testFilter() {
Filter filterConf = new Filter(null, parseExpr("a=5"), 1.0f);
List<String> inputJsonBatches = Lists.newArrayList("[{\"a\": 5, \"b\" : 1 }]", "[{\"a\": 5, \"b\" : 5},{\"a\": 3, \"b\" : 8}]", "[{\"a\": 40, \"b\" : 3},{\"a\": 13, \"b\" : 100}]");
opTestBuilder().physicalOperator(filterConf).inputDataStreamJson(inputJsonBatches).baselineColumns("a", "b").baselineValues(5l, 1l).baselineValues(5l, 5l).go();
}
Aggregations