Search in sources :

Example 16 with PhysicalOperator

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

the class ProducerConsumerPrel method getPhysicalOperator.

@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    Prel child = (Prel) this.getInput();
    PhysicalOperator childPOP = child.getPhysicalOperator(creator);
    ProducerConsumer pop = new ProducerConsumer(childPOP, queueSize);
    return creator.addMetadata(this, pop);
}
Also used : ProducerConsumer(org.apache.drill.exec.physical.config.ProducerConsumer) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator)

Example 17 with PhysicalOperator

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

the class HashToRandomExchangePrel 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;
    }
    // TODO - refactor to different exchange name
    HashToRandomExchange g = new HashToRandomExchange(childPOP, HashPrelUtil.getHashExpression(this.fields, getInput().getRowType()));
    return creator.addMetadata(this, g);
}
Also used : PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) HashToRandomExchange(org.apache.drill.exec.physical.config.HashToRandomExchange)

Example 18 with PhysicalOperator

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

the class NestedLoopJoinPrel method getPhysicalOperator.

@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    PhysicalOperator leftPop = ((Prel) left).getPhysicalOperator(creator);
    PhysicalOperator rightPop = ((Prel) right).getPhysicalOperator(creator);
    /*
       Raw expression will be transformed into its logical representation. For example:
       Query:
         select t1.c1, t2.c1, t2.c2 from t1 inner join t2 on t1.c1 between t2.c1 and t2.c2
       Raw expression:
         AND(>=($0, $1), <=($0, $2))
       Logical expression:
         FunctionCall [func=booleanAnd,
         args=[FunctionCall [func=greater_than_or_equal_to, args=[`i1`, `i10`]],
               FunctionCall [func=less_than_or_equal_to, args=[`i1`, `i2`]]]

       Both tables have the same column name thus duplicated column name in second table are renamed: i1 -> i10.
    */
    LogicalExpression condition = DrillOptiq.toDrill(new DrillParseContext(PrelUtil.getSettings(getCluster())), getInputs(), getCondition());
    NestedLoopJoinPOP nlj = new NestedLoopJoinPOP(leftPop, rightPop, getJoinType(), condition);
    return creator.addMetadata(this, nlj);
}
Also used : LogicalExpression(org.apache.drill.common.expression.LogicalExpression) PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) DrillParseContext(org.apache.drill.exec.planner.logical.DrillParseContext) NestedLoopJoinPOP(org.apache.drill.exec.physical.config.NestedLoopJoinPOP)

Example 19 with PhysicalOperator

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

the class ScreenPrel method getPhysicalOperator.

@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    Prel child = (Prel) this.getInput();
    PhysicalOperator childPOP = child.getPhysicalOperator(creator);
    Screen s = new Screen(childPOP, creator.getContext().getCurrentEndpoint());
    return creator.addMetadata(this, s);
}
Also used : PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) Screen(org.apache.drill.exec.physical.config.Screen)

Example 20 with PhysicalOperator

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

the class LimitPrel method getPhysicalOperator.

@Override
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
    Prel child = (Prel) this.getInput();
    PhysicalOperator childPOP = child.getPhysicalOperator(creator);
    // First offset to include into results (inclusive). Null implies it is starting from offset 0
    int first = offset != null ? Math.max(0, RexLiteral.intValue(offset)) : 0;
    // Last offset to stop including into results (exclusive), translating fetch row counts into an offset.
    // Null value implies including entire remaining result set from first offset
    Integer last = fetch != null ? Math.max(0, RexLiteral.intValue(fetch)) + first : null;
    Limit limit = new Limit(childPOP, first, last);
    return creator.addMetadata(this, limit);
}
Also used : PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) Limit(org.apache.drill.exec.physical.config.Limit)

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