Search in sources :

Example 6 with AlgebricksPipeline

use of org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline in project asterixdb by apache.

the class MicroPreclusteredGroupByPOperator method contributeRuntimeOperator.

@Override
public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException {
    int[] keys = JobGenHelper.variablesToFieldIndexes(columnList, inputSchemas[0]);
    GroupByOperator gby = (GroupByOperator) op;
    IVariableTypeEnvironment env = context.getTypeEnvironment(op);
    int[] fdColumns = getFdColumns(gby, inputSchemas[0]);
    // compile subplans and set the gby op. schema accordingly
    AlgebricksPipeline[] subplans = compileSubplans(inputSchemas[0], gby, opSchema, context);
    IAggregatorDescriptorFactory aggregatorFactory = new NestedPlansAccumulatingAggregatorFactory(subplans, keys, fdColumns);
    IBinaryComparatorFactory[] comparatorFactories = JobGenHelper.variablesToAscBinaryComparatorFactories(columnList, env, context);
    RecordDescriptor recordDescriptor = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context);
    RecordDescriptor inputRecordDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas[0], context);
    MicroPreClusteredGroupRuntimeFactory runtime = new MicroPreClusteredGroupRuntimeFactory(keys, comparatorFactories, aggregatorFactory, inputRecordDesc, recordDescriptor, null);
    builder.contributeMicroOperator(gby, runtime, recordDescriptor);
    ILogicalOperator src = op.getInputs().get(0).getValue();
    builder.contributeGraphEdge(src, 0, op, 0);
}
Also used : GroupByOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator) MicroPreClusteredGroupRuntimeFactory(org.apache.hyracks.algebricks.runtime.operators.group.MicroPreClusteredGroupRuntimeFactory) RecordDescriptor(org.apache.hyracks.api.dataflow.value.RecordDescriptor) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) IBinaryComparatorFactory(org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory) NestedPlansAccumulatingAggregatorFactory(org.apache.hyracks.algebricks.runtime.operators.aggreg.NestedPlansAccumulatingAggregatorFactory) AlgebricksPipeline(org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline) IAggregatorDescriptorFactory(org.apache.hyracks.dataflow.std.group.IAggregatorDescriptorFactory) IVariableTypeEnvironment(org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment)

Example 7 with AlgebricksPipeline

use of org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline in project asterixdb by apache.

the class AbstractPhysicalOperator method compileSubplans.

protected AlgebricksPipeline[] compileSubplans(IOperatorSchema outerPlanSchema, AbstractOperatorWithNestedPlans npOp, IOperatorSchema opSchema, JobGenContext context) throws AlgebricksException {
    AlgebricksPipeline[] subplans = new AlgebricksPipeline[npOp.getNestedPlans().size()];
    PlanCompiler pc = new PlanCompiler(context);
    int i = 0;
    for (ILogicalPlan p : npOp.getNestedPlans()) {
        subplans[i++] = buildPipelineWithProjection(p, outerPlanSchema, npOp, opSchema, pc);
    }
    return subplans;
}
Also used : PlanCompiler(org.apache.hyracks.algebricks.core.jobgen.impl.PlanCompiler) ILogicalPlan(org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan) AlgebricksPipeline(org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) AlgebricksCountPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint)

Aggregations

AlgebricksPipeline (org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline)7 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)6 NestedPlansAccumulatingAggregatorFactory (org.apache.hyracks.algebricks.runtime.operators.aggreg.NestedPlansAccumulatingAggregatorFactory)4 File (java.io.File)3 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)3 TupleFieldEvaluatorFactory (org.apache.hyracks.algebricks.runtime.evaluators.TupleFieldEvaluatorFactory)3 AlgebricksMetaOperatorDescriptor (org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor)3 NestedTupleSourceRuntimeFactory (org.apache.hyracks.algebricks.runtime.operators.std.NestedTupleSourceRuntimeFactory)3 SinkWriterRuntimeFactory (org.apache.hyracks.algebricks.runtime.operators.std.SinkWriterRuntimeFactory)3 JobSpecification (org.apache.hyracks.api.job.JobSpecification)3 Test (org.junit.Test)3 GroupByOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator)2 TupleCountAggregateFunctionFactory (org.apache.hyracks.algebricks.runtime.aggregators.TupleCountAggregateFunctionFactory)2 IScalarEvaluatorFactory (org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory)2 AggregateRuntimeFactory (org.apache.hyracks.algebricks.runtime.operators.aggreg.AggregateRuntimeFactory)2 MicroPreClusteredGroupRuntimeFactory (org.apache.hyracks.algebricks.runtime.operators.group.MicroPreClusteredGroupRuntimeFactory)2 SubplanRuntimeFactory (org.apache.hyracks.algebricks.runtime.operators.meta.SubplanRuntimeFactory)2 RunningAggregateRuntimeFactory (org.apache.hyracks.algebricks.runtime.operators.std.RunningAggregateRuntimeFactory)2 StreamSelectRuntimeFactory (org.apache.hyracks.algebricks.runtime.operators.std.StreamSelectRuntimeFactory)2 IBinaryComparatorFactory (org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory)2