use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.
the class PopUnitTestBase method getRootFragmentFromPlanString.
public static Fragment getRootFragmentFromPlanString(PhysicalPlanReader reader, String planString) throws FragmentSetupException, IOException, ForemanSetupException {
PhysicalPlan plan = reader.readPhysicalPlan(planString);
PhysicalOperator o = plan.getSortedOperators(false).iterator().next();
return o.accept(MakeFragmentsVisitor.INSTANCE, null);
}
use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.
the class ImplCreator method getRecordBatch.
/** Create a RecordBatch and its children for given PhysicalOperator */
@VisibleForTesting
public RecordBatch getRecordBatch(final PhysicalOperator op, final FragmentContext context) throws ExecutionSetupException {
Preconditions.checkNotNull(op);
final List<RecordBatch> childRecordBatches = getChildren(op, context);
if (context.isImpersonationEnabled()) {
final UserGroupInformation proxyUgi = ImpersonationUtil.createProxyUgi(op.getUserName(), context.getQueryUserName());
try {
return proxyUgi.doAs(new PrivilegedExceptionAction<RecordBatch>() {
@Override
public RecordBatch run() throws Exception {
final CloseableRecordBatch batch = ((BatchCreator<PhysicalOperator>) getOpCreator(op, context)).getBatch(context, op, childRecordBatches);
operators.addFirst(batch);
return batch;
}
});
} catch (InterruptedException | IOException e) {
final String errMsg = String.format("Failed to create RecordBatch for operator with id '%d'", op.getOperatorId());
logger.error(errMsg, e);
throw new ExecutionSetupException(errMsg, e);
}
} else {
final CloseableRecordBatch batch = ((BatchCreator<PhysicalOperator>) getOpCreator(op, context)).getBatch(context, op, childRecordBatches);
operators.addFirst(batch);
return batch;
}
}
use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.
the class TopNPrel method getPhysicalOperator.
@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
Prel child = (Prel) this.getInput();
PhysicalOperator childPOP = child.getPhysicalOperator(creator);
TopN topN = new TopN(childPOP, PrelUtil.getOrdering(this.collation, getInput().getRowType()), false, this.limit);
return creator.addMetadata(this, topN);
}
use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.
the class ProjectAllowDupPrel method getPhysicalOperator.
@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
Prel child = (Prel) this.getInput();
PhysicalOperator childPOP = child.getPhysicalOperator(creator);
Project p = new Project(this.getProjectExpressions(new DrillParseContext(PrelUtil.getSettings(getCluster()))), childPOP);
return creator.addMetadata(this, p);
}
use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.
the class ProjectPrel method getPhysicalOperator.
@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
Prel child = (Prel) this.getInput();
PhysicalOperator childPOP = child.getPhysicalOperator(creator);
org.apache.drill.exec.physical.config.Project p = new org.apache.drill.exec.physical.config.Project(this.getProjectExpressions(new DrillParseContext(PrelUtil.getSettings(getCluster()))), childPOP);
return creator.addMetadata(this, p);
}
Aggregations