Search in sources :

Example 1 with PlanPropertiesBuilder

use of org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder in project drill by apache.

the class DefaultSqlHandler method convertToPlan.

protected PhysicalPlan convertToPlan(PhysicalOperator op) {
    PlanPropertiesBuilder propsBuilder = PlanProperties.builder();
    propsBuilder.type(PlanType.APACHE_DRILL_PHYSICAL);
    propsBuilder.version(1);
    propsBuilder.options(new JSONOptions(context.getOptions().getOptionList()));
    propsBuilder.resultMode(ResultMode.EXEC);
    propsBuilder.generator(this.getClass().getSimpleName(), "");
    return new PhysicalPlan(propsBuilder.build(), getPops(op));
}
Also used : JSONOptions(org.apache.drill.common.JSONOptions) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) PlanPropertiesBuilder(org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder)

Example 2 with PlanPropertiesBuilder

use of org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder in project drill by apache.

the class PhysicalPlanCreator method build.

public PhysicalPlan build(Prel rootPrel, boolean forceRebuild) {
    if (plan != null && !forceRebuild) {
        return plan;
    }
    PlanPropertiesBuilder propsBuilder = PlanProperties.builder();
    propsBuilder.type(PlanType.APACHE_DRILL_PHYSICAL);
    propsBuilder.version(1);
    propsBuilder.resultMode(ResultMode.EXEC);
    propsBuilder.generator(PhysicalPlanCreator.class.getName(), "");
    try {
        // invoke getPhysicalOperator on the root Prel which will recursively invoke it
        // on the descendants and we should have a well-formed physical operator tree
        PhysicalOperator rootPOP = rootPrel.getPhysicalOperator(this);
        if (rootPOP != null) {
            //getPhysicalOperator() is supposed to populate this list
            assert (popList.size() > 0);
            plan = new PhysicalPlan(propsBuilder.build(), popList);
        }
    } catch (IOException e) {
        plan = null;
        throw new UnsupportedOperationException("Physical plan created failed with error : " + e.toString());
    }
    return plan;
}
Also used : PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) PlanPropertiesBuilder(org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder) IOException(java.io.IOException)

Example 3 with PlanPropertiesBuilder

use of org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder in project drill by apache.

the class DirectPlan method createDirectPlan.

public static <T> PhysicalPlan createDirectPlan(DrillbitEndpoint endpoint, Iterator<T> iterator, Class<T> clazz) {
    PojoRecordReader<T> reader = new PojoRecordReader<T>(clazz, iterator);
    DirectGroupScan scan = new DirectGroupScan(reader);
    Screen screen = new Screen(scan, endpoint);
    PlanPropertiesBuilder propsBuilder = PlanProperties.builder();
    propsBuilder.type(PlanType.APACHE_DRILL_PHYSICAL);
    propsBuilder.version(1);
    propsBuilder.resultMode(ResultMode.EXEC);
    propsBuilder.generator(DirectPlan.class.getSimpleName(), "");
    return new PhysicalPlan(propsBuilder.build(), DefaultSqlHandler.getPops(screen));
}
Also used : PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) Screen(org.apache.drill.exec.physical.config.Screen) DirectGroupScan(org.apache.drill.exec.store.direct.DirectGroupScan) PlanPropertiesBuilder(org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder) PojoRecordReader(org.apache.drill.exec.store.pojo.PojoRecordReader)

Aggregations

PlanPropertiesBuilder (org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder)3 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)3 IOException (java.io.IOException)1 JSONOptions (org.apache.drill.common.JSONOptions)1 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)1 Screen (org.apache.drill.exec.physical.config.Screen)1 DirectGroupScan (org.apache.drill.exec.store.direct.DirectGroupScan)1 PojoRecordReader (org.apache.drill.exec.store.pojo.PojoRecordReader)1