Search in sources :

Example 1 with SinkOperator

use of org.apache.drill.common.logical.data.SinkOperator 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 2 with SinkOperator

use of org.apache.drill.common.logical.data.SinkOperator in project drill by axbaretto.

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();
    final PhysicalPlan p = new PhysicalPlan(props, physOps);
    return p;
}
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)

Aggregations

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