use of org.apache.drill.exec.physical.config.Project in project drill by apache.
the class ProjectAllowDupPrel method getPhysicalOperator.
@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
Prel child = (Prel) this.getInput();
PhysicalOperator childPOP = child.getPhysicalOperator(creator);
Project p = new Project(this.getProjectExpressions(new DrillParseContext(PrelUtil.getSettings(getCluster()))), childPOP);
return creator.addMetadata(this, p);
}
use of org.apache.drill.exec.physical.config.Project in project drill by apache.
the class BasicPhysicalOpUnitTest method testSimpleProject.
@Test
public void testSimpleProject() {
Project projectConf = new Project(parseExprs("x+5", "x"), null);
List<String> jsonBatches = Lists.newArrayList("[{\"x\": 5 },{\"x\": 10 }]", "[{\"x\": 20 },{\"x\": 30 },{\"x\": 40 }]");
opTestBuilder().physicalOperator(projectConf).inputDataStreamJson(jsonBatches).baselineColumns("x").baselineValues(10l).baselineValues(15l).baselineValues(25l).baselineValues(35l).baselineValues(45l).go();
}
use of org.apache.drill.exec.physical.config.Project in project drill by apache.
the class BasicPhysicalOpUnitTest method testProjectComplexOutput.
@Test
public void testProjectComplexOutput() {
Project projectConf = new Project(parseExprs("convert_from(json_col, 'JSON')", "complex_col"), null);
List<String> jsonBatches = Lists.newArrayList("[{\"json_col\": \"{ \\\"a\\\" : 1 }\"}]", "[{\"json_col\": \"{ \\\"a\\\" : 5 }\"}]");
opTestBuilder().physicalOperator(projectConf).inputDataStreamJson(jsonBatches).baselineColumns("complex_col").baselineValues(mapOf("a", 1l)).baselineValues(mapOf("a", 5l)).go();
}
Aggregations