Search in sources :

Example 6 with JSONOptions

use of org.apache.drill.common.JSONOptions 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

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