@Override public void contributeRuntimeOperator( IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context); int[] primaryKeyFields = JobGenHelper.variablesToFieldIndexes(primaryKeyLogicalVars, inputSchemas[0]); AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider(); CommitRuntimeFactory runtime = new CommitRuntimeFactory( jobId, datasetId, primaryKeyFields, metadataProvider.isTemporaryDatasetWriteJob(), metadataProvider.isWriteTransaction()); builder.contributeMicroOperator(op, runtime, recDesc); ILogicalOperator src = op.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, op, 0); }
@Override public void contributeRuntimeOperator( IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { ScriptOperator scriptOp = (ScriptOperator) op; IScriptDescription scriptDesc = scriptOp.getScriptDescription(); if (scriptDesc.getKind() != ScriptKind.STRING_STREAMING) { throw new IllegalStateException(); } StringStreamingScriptDescription sssd = (StringStreamingScriptDescription) scriptDesc; StringStreamingRuntimeFactory runtime = new StringStreamingRuntimeFactory( sssd.getCommand(), sssd.getPrinterFactories(), sssd.getFieldDelimiter(), sssd.getParserFactory()); RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context); builder.contributeMicroOperator(scriptOp, runtime, recDesc); // and contribute one edge from its child ILogicalOperator src = scriptOp.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, scriptOp, 0); }
@Override public void contributeRuntimeOperator( IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { RunningAggregateOperator ragg = (RunningAggregateOperator) op; List<LogicalVariable> variables = ragg.getVariables(); List<Mutable<ILogicalExpression>> expressions = ragg.getExpressions(); int[] outColumns = new int[variables.size()]; for (int i = 0; i < outColumns.length; i++) { outColumns[i] = opSchema.findVariable(variables.get(i)); } IRunningAggregateEvaluatorFactory[] runningAggFuns = new IRunningAggregateEvaluatorFactory[expressions.size()]; IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); for (int i = 0; i < runningAggFuns.length; i++) { StatefulFunctionCallExpression expr = (StatefulFunctionCallExpression) expressions.get(i).getValue(); runningAggFuns[i] = expressionRuntimeProvider.createRunningAggregateFunctionFactory( expr, context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas, context); } // TODO push projections into the operator int[] projectionList = JobGenHelper.projectAllVariables(opSchema); RunningAggregateRuntimeFactory runtime = new RunningAggregateRuntimeFactory(outColumns, runningAggFuns, projectionList); // contribute one Asterix framewriter RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context); builder.contributeMicroOperator(ragg, runtime, recDesc); // and contribute one edge from its child ILogicalOperator src = ragg.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, ragg, 0); }
@Override public void contributeRuntimeOperator( IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { IndexInsertDeleteUpsertOperator indexInsertDeleteOp = (IndexInsertDeleteUpsertOperator) op; assert indexInsertDeleteOp.getOperation() == Kind.INSERT; assert indexInsertDeleteOp.isBulkload(); IMetadataProvider mp = context.getMetadataProvider(); IVariableTypeEnvironment typeEnv = context.getTypeEnvironment(op); JobSpecification spec = builder.getJobSpec(); RecordDescriptor inputDesc = JobGenHelper.mkRecordDescriptor( context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas[0], context); Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> runtimeAndConstraints = mp.getIndexInsertRuntime( dataSourceIndex, propagatedSchema, inputSchemas, typeEnv, primaryKeys, secondaryKeys, additionalFilteringKeys, filterExpr, inputDesc, context, spec, true); builder.contributeHyracksOperator(indexInsertDeleteOp, runtimeAndConstraints.first); builder.contributeAlgebricksPartitionConstraint( runtimeAndConstraints.first, runtimeAndConstraints.second); ILogicalOperator src = indexInsertDeleteOp.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, indexInsertDeleteOp, 0); }