Search in sources :

Example 31 with PhysicalOperator

use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.

the class MergeJoinPrel method getPhysicalOperator.

@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    final List<String> fields = getRowType().getFieldNames();
    assert isUnique(fields);
    final int leftCount = left.getRowType().getFieldCount();
    final List<String> leftFields = fields.subList(0, leftCount);
    final List<String> rightFields = fields.subList(leftCount, fields.size());
    PhysicalOperator leftPop = ((Prel) left).getPhysicalOperator(creator);
    PhysicalOperator rightPop = ((Prel) right).getPhysicalOperator(creator);
    JoinRelType jtype = this.getJoinType();
    List<JoinCondition> conditions = Lists.newArrayList();
    buildJoinConditions(conditions, leftFields, rightFields, leftKeys, rightKeys);
    MergeJoinPOP mjoin = new MergeJoinPOP(leftPop, rightPop, conditions, jtype);
    return creator.addMetadata(this, mjoin);
}
Also used : JoinRelType(org.apache.calcite.rel.core.JoinRelType) MergeJoinPOP(org.apache.drill.exec.physical.config.MergeJoinPOP) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) JoinCondition(org.apache.drill.common.logical.data.JoinCondition)

Example 32 with PhysicalOperator

use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.

the class FilterPrel method getPhysicalOperator.

@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    Prel child = (Prel) this.getInput();
    PhysicalOperator childPOP = child.getPhysicalOperator(creator);
    Filter p = new Filter(childPOP, getFilterExpression(new DrillParseContext(PrelUtil.getSettings(getCluster()))), 1.0f);
    return creator.addMetadata(this, p);
}
Also used : Filter(org.apache.drill.exec.physical.config.Filter) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) DrillParseContext(org.apache.drill.exec.planner.logical.DrillParseContext)

Example 33 with PhysicalOperator

use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.

the class FlattenPrel method getPhysicalOperator.

@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    Prel child = (Prel) this.getInput();
    PhysicalOperator childPOP = child.getPhysicalOperator(creator);
    FlattenPOP f = new FlattenPOP(childPOP, (SchemaPath) getFlattenExpression(new DrillParseContext(PrelUtil.getSettings(getCluster()))));
    return creator.addMetadata(this, f);
}
Also used : FlattenPOP(org.apache.drill.exec.physical.config.FlattenPOP) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) DrillParseContext(org.apache.drill.exec.planner.logical.DrillParseContext)

Example 34 with PhysicalOperator

use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.

the class HashToMergeExchangePrel method getPhysicalOperator.

public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    Prel child = (Prel) this.getInput();
    PhysicalOperator childPOP = child.getPhysicalOperator(creator);
    if (PrelUtil.getSettings(getCluster()).isSingleMode()) {
        return childPOP;
    }
    HashToMergeExchange g = new HashToMergeExchange(childPOP, HashPrelUtil.getHashExpression(this.distFields, getInput().getRowType()), PrelUtil.getOrdering(this.collation, getInput().getRowType()));
    return creator.addMetadata(this, g);
}
Also used : HashToMergeExchange(org.apache.drill.exec.physical.config.HashToMergeExchange) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator)

Example 35 with PhysicalOperator

use of org.apache.drill.exec.physical.base.PhysicalOperator in project drill by apache.

the class Foreman method acquireQuerySemaphore.

/**
   * This limits the number of "small" and "large" queries that a Drill cluster will run
   * simultaneously, if queueing is enabled. If the query is unable to run, this will block
   * until it can. Beware that this is called under run(), and so will consume a Thread
   * while it waits for the required distributed semaphore.
   *
   * @param plan the query plan
   * @throws ForemanSetupException
   */
private void acquireQuerySemaphore(final PhysicalPlan plan) throws ForemanSetupException {
    double totalCost = 0;
    for (final PhysicalOperator ops : plan.getSortedOperators()) {
        totalCost += ops.getCost();
    }
    acquireQuerySemaphore(totalCost);
    return;
}
Also used : PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator)

Aggregations

PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)57 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)13 FragmentRoot (org.apache.drill.exec.physical.base.FragmentRoot)6 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)6 Test (org.junit.Test)6 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)4 Fragment (org.apache.drill.exec.planner.fragment.Fragment)4 DrillParseContext (org.apache.drill.exec.planner.logical.DrillParseContext)4 PlanFragment (org.apache.drill.exec.proto.BitControl.PlanFragment)4 IOException (java.io.IOException)3 RelNode (org.apache.calcite.rel.RelNode)3 RelDataType (org.apache.calcite.rel.type.RelDataType)3 DrillConfig (org.apache.drill.common.config.DrillConfig)3 FragmentContext (org.apache.drill.exec.ops.FragmentContext)3 OpProfileDef (org.apache.drill.exec.ops.OpProfileDef)3 OperatorStats (org.apache.drill.exec.ops.OperatorStats)3 QueryWorkUnit (org.apache.drill.exec.work.QueryWorkUnit)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 JoinRelType (org.apache.calcite.rel.core.JoinRelType)2 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)2