Search in sources :

Example 1 with NestedPlansRunningAggregatorFactory

use of org.apache.hyracks.algebricks.runtime.operators.aggreg.NestedPlansRunningAggregatorFactory in project asterixdb by apache.

the class PreclusteredGroupByPOperator 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;
    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;
    if (gby.getNestedPlans().get(0).getRoots().get(0).getValue().getOperatorTag() == LogicalOperatorTag.RUNNINGAGGREGATE) {
        aggregatorFactory = new NestedPlansRunningAggregatorFactory(subplans, keys, fdColumns);
    } else {
        aggregatorFactory = new NestedPlansAccumulatingAggregatorFactory(subplans, keys, fdColumns);
    }
    IOperatorDescriptorRegistry spec = builder.getJobSpec();
    IBinaryComparatorFactory[] comparatorFactories = JobGenHelper.variablesToAscBinaryComparatorFactories(columnList, context.getTypeEnvironment(op), context);
    RecordDescriptor recordDescriptor = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context);
    PreclusteredGroupOperatorDescriptor opDesc = new PreclusteredGroupOperatorDescriptor(spec, keys, comparatorFactories, aggregatorFactory, recordDescriptor, groupAll);
    contributeOpDesc(builder, (AbstractLogicalOperator) op, opDesc);
    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) 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) IOperatorDescriptorRegistry(org.apache.hyracks.api.job.IOperatorDescriptorRegistry) IAggregatorDescriptorFactory(org.apache.hyracks.dataflow.std.group.IAggregatorDescriptorFactory) NestedPlansRunningAggregatorFactory(org.apache.hyracks.algebricks.runtime.operators.aggreg.NestedPlansRunningAggregatorFactory) PreclusteredGroupOperatorDescriptor(org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupOperatorDescriptor) AlgebricksPipeline(org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline)

Aggregations

ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)1 GroupByOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator)1 AlgebricksPipeline (org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline)1 NestedPlansAccumulatingAggregatorFactory (org.apache.hyracks.algebricks.runtime.operators.aggreg.NestedPlansAccumulatingAggregatorFactory)1 NestedPlansRunningAggregatorFactory (org.apache.hyracks.algebricks.runtime.operators.aggreg.NestedPlansRunningAggregatorFactory)1 IBinaryComparatorFactory (org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory)1 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)1 IOperatorDescriptorRegistry (org.apache.hyracks.api.job.IOperatorDescriptorRegistry)1 IAggregatorDescriptorFactory (org.apache.hyracks.dataflow.std.group.IAggregatorDescriptorFactory)1 PreclusteredGroupOperatorDescriptor (org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupOperatorDescriptor)1