Пример #1
0
 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));
 }
Пример #2
0
  @Override
  public PhysicalPlan optimize(OptimizationContext context, LogicalPlan plan)
      throws OptimizerException {
    Object obj = new Object();
    Collection<SinkOperator> roots = plan.getGraph().getRoots();
    List<PhysicalOperator> physOps = new ArrayList<PhysicalOperator>(roots.size());
    LogicalConverter converter = new LogicalConverter(plan);
    for (SinkOperator op : roots) {
      PhysicalOperator pop = op.accept(converter, obj);
      physOps.add(pop);
    }

    PlanProperties props =
        PlanProperties.builder()
            .type(PlanProperties.PlanType.APACHE_DRILL_PHYSICAL)
            .version(plan.getProperties().version)
            .generator(plan.getProperties().generator)
            .build();
    PhysicalPlan p = new PhysicalPlan(props, physOps);
    return p;
    // return new PhysicalPlan(props, physOps);
  }