protected int[] getKeysAndDecs(IOperatorSchema inputSchema) { int keys[] = JobGenHelper.variablesToFieldIndexes(columnList, inputSchema); int sz = inputSchema.getSize(); int fdSz = sz - columnList.size(); int[] fdColumns = new int[fdSz]; int j = 0; for (LogicalVariable v : inputSchema) { if (!columnList.contains(v)) { fdColumns[j++] = inputSchema.findVariable(v); } } int[] keysAndDecs = new int[keys.length + fdColumns.length]; for (int i = 0; i < keys.length; i++) { keysAndDecs[i] = keys[i]; } for (int i = 0; i < fdColumns.length; i++) { keysAndDecs[i + keys.length] = fdColumns[i]; } return keysAndDecs; }
@Override public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider(); RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context); int[] primaryKeyFields = JobGenHelper.variablesToFieldIndexes(primaryKeyLogicalVars, inputSchemas[0]); //get dataset splits IPushRuntimeFactory runtime = dataset.getCommitRuntimeFactory(metadataProvider, primaryKeyFields, isSink); runtime.setSourceLocation(op.getSourceLocation()); builder.contributeMicroOperator(op, runtime, recDesc); ILogicalOperator src = op.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, op, 0); }
IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { int[] keysLeft = JobGenHelper.variablesToFieldIndexes(keysLeftBranch, inputSchemas[0]); int[] keysRight = JobGenHelper.variablesToFieldIndexes(keysRightBranch, inputSchemas[1]); IVariableTypeEnvironment env = context.getTypeEnvironment(op); IBinaryHashFunctionFamily[] hashFunFamilies =
@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); AbstractAggregatorDescriptorFactory aggregatorFactory; List<ILogicalPlan> nestedPlans = gby.getNestedPlans(); if (!nestedPlans.isEmpty() && nestedPlans.get(0).getRoots().get(0).getValue() .getOperatorTag() == LogicalOperatorTag.RUNNINGAGGREGATE) { aggregatorFactory = new NestedPlansRunningAggregatorFactory(subplans, keys, fdColumns); } else { aggregatorFactory = new NestedPlansAccumulatingAggregatorFactory(subplans, keys, fdColumns); } aggregatorFactory.setSourceLocation(gby.getSourceLocation()); 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, framesLimit); opDesc.setSourceLocation(gby.getSourceLocation()); contributeOpDesc(builder, gby, opDesc); ILogicalOperator src = op.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, op, 0); }
compareFields[i] = JobGenHelper.variablesToFieldIndexes(logicalOp.getCompareVariables(i), inputSchemas[i]); for (int i = 0; i < logicalOp.getNumInput(); i++) { extraFields[i] = JobGenHelper.variablesToFieldIndexes(logicalOp.getExtraVariables().get(i), inputSchemas[i]);
@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); runtime.setSourceLocation(gby.getSourceLocation()); builder.contributeMicroOperator(gby, runtime, recordDescriptor); ILogicalOperator src = op.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, op, 0); }
IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { int[] keysLeft = JobGenHelper.variablesToFieldIndexes(keysLeftBranch, inputSchemas[0]); int[] keysRight = JobGenHelper.variablesToFieldIndexes(keysRightBranch, inputSchemas[1]); IVariableTypeEnvironment env = context.getTypeEnvironment(op); IBinaryHashFunctionFactory[] hashFunFactories =
throws AlgebricksException { List<LogicalVariable> gbyCols = getGbyColumns(); int keys[] = JobGenHelper.variablesToFieldIndexes(gbyCols, inputSchemas[0]); GroupByOperator gby = (GroupByOperator) op; int numFds = gby.getDecorList().size();
throws AlgebricksException { List<LogicalVariable> gbyCols = getGbyColumns(); int keys[] = JobGenHelper.variablesToFieldIndexes(gbyCols, inputSchemas[0]); GroupByOperator gby = (GroupByOperator) op; int numFds = gby.getDecorList().size();