Search in sources :

Example 1 with JSONOptions

use of org.apache.drill.common.JSONOptions in project drill by axbaretto.

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 JSONOptions

use of org.apache.drill.common.JSONOptions in project drill by apache.

the class BasicOptimizer method optimize.

@Override
public PhysicalPlan optimize(final OptimizationContext context, final LogicalPlan plan) throws OptimizerException {
    final Object obj = new Object();
    final Collection<SinkOperator> roots = plan.getGraph().getRoots();
    final List<PhysicalOperator> physOps = new ArrayList<>(roots.size());
    final LogicalConverter converter = new LogicalConverter(plan);
    for (SinkOperator op : roots) {
        final PhysicalOperator pop = op.accept(converter, obj);
        physOps.add(pop);
    }
    final PlanProperties logicalProperties = plan.getProperties();
    final PlanProperties props = PlanProperties.builder().type(PlanProperties.PlanType.APACHE_DRILL_PHYSICAL).version(logicalProperties.version).generator(logicalProperties.generator).options(new JSONOptions(context.getOptions().getOptionList())).build();
    return new PhysicalPlan(props, physOps);
}
Also used : JSONOptions(org.apache.drill.common.JSONOptions) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) SinkOperator(org.apache.drill.common.logical.data.SinkOperator) PlanProperties(org.apache.drill.common.logical.PlanProperties) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) ArrayList(java.util.ArrayList)

Example 3 with JSONOptions

use of org.apache.drill.common.JSONOptions in project drill by apache.

the class DrillScanRel method implement.

@Override
public LogicalOperator implement(DrillImplementor implementor) {
    Scan.Builder builder = Scan.builder();
    builder.storageEngine(drillTable.getStorageEngineName());
    builder.selection(new JSONOptions(drillTable.getSelection()));
    implementor.registerSource(drillTable);
    return builder.build();
}
Also used : JSONOptions(org.apache.drill.common.JSONOptions) Scan(org.apache.drill.common.logical.data.Scan) GroupScan(org.apache.drill.exec.physical.base.GroupScan)

Example 4 with JSONOptions

use of org.apache.drill.common.JSONOptions 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(), "");
    PhysicalPlan plan = new PhysicalPlan(propsBuilder.build(), getPops(op));
    return plan;
}
Also used : JSONOptions(org.apache.drill.common.JSONOptions) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) PlanPropertiesBuilder(org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder)

Example 5 with JSONOptions

use of org.apache.drill.common.JSONOptions in project drill by axbaretto.

the class DrillScanRel method implement.

@Override
public LogicalOperator implement(DrillImplementor implementor) {
    Scan.Builder builder = Scan.builder();
    builder.storageEngine(drillTable.getStorageEngineName());
    builder.selection(new JSONOptions(drillTable.getSelection()));
    implementor.registerSource(drillTable);
    return builder.build();
}
Also used : JSONOptions(org.apache.drill.common.JSONOptions) Scan(org.apache.drill.common.logical.data.Scan) GroupScan(org.apache.drill.exec.physical.base.GroupScan)

Aggregations

JSONOptions (org.apache.drill.common.JSONOptions)6 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)4 ArrayList (java.util.ArrayList)2 PlanProperties (org.apache.drill.common.logical.PlanProperties)2 PlanPropertiesBuilder (org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder)2 Scan (org.apache.drill.common.logical.data.Scan)2 SinkOperator (org.apache.drill.common.logical.data.SinkOperator)2 GroupScan (org.apache.drill.exec.physical.base.GroupScan)2 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)2