@Override public AsterixTupleFilterFactory createTupleFilterFactory(IOperatorSchema[] inputSchemas, IVariableTypeEnvironment typeEnv, ILogicalExpression filterExpr, JobGenContext context) throws AlgebricksException { // No filtering condition. if (filterExpr == null) { return null; } IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); IScalarEvaluatorFactory filterEvalFactory = expressionRuntimeProvider.createEvaluatorFactory(filterExpr, typeEnv, inputSchemas, context); return new AsterixTupleFilterFactory(filterEvalFactory, context.getBinaryBooleanInspectorFactory()); }
@Override public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { AggregateOperator aggOp = (AggregateOperator) op; List<LogicalVariable> variables = aggOp.getVariables(); List<Mutable<ILogicalExpression>> expressions = aggOp.getExpressions(); int[] outColumns = new int[variables.size()]; for (int i = 0; i < outColumns.length; i++) { outColumns[i] = opSchema.findVariable(variables.get(i)); } IAggregateEvaluatorFactory[] aggFactories = new IAggregateEvaluatorFactory[expressions.size()]; IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); for (int i = 0; i < aggFactories.length; i++) { AggregateFunctionCallExpression aggFun = (AggregateFunctionCallExpression) expressions.get(i).getValue(); aggFactories[i] = expressionRuntimeProvider.createAggregateFunctionFactory(aggFun, context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas, context); } AggregateRuntimeFactory runtime = new AggregateRuntimeFactory(aggFactories); runtime.setSourceLocation(aggOp.getSourceLocation()); // contribute one Asterix framewriter RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context); builder.contributeMicroOperator(aggOp, runtime, recDesc); // and contribute one edge from its child ILogicalOperator src = aggOp.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, aggOp, 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(projectionList, outColumns, runningAggFuns); runtime.setSourceLocation(ragg.getSourceLocation()); // 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); }
IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); for (int i = 0; i < evalFactories.length; i++) { evalFactories[i] = expressionRuntimeProvider.createEvaluatorFactory(expressions.get(i).getValue(),
@Override public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { LimitOperator limit = (LimitOperator) op; IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); IVariableTypeEnvironment env = context.getTypeEnvironment(op); IScalarEvaluatorFactory maxObjectsFact = expressionRuntimeProvider .createEvaluatorFactory(limit.getMaxObjects().getValue(), env, inputSchemas, context); ILogicalExpression offsetExpr = limit.getOffset().getValue(); IScalarEvaluatorFactory offsetFact = (offsetExpr == null) ? null : expressionRuntimeProvider.createEvaluatorFactory(offsetExpr, env, inputSchemas, context); RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context); StreamLimitRuntimeFactory runtime = new StreamLimitRuntimeFactory(maxObjectsFact, offsetFact, null, context.getBinaryIntegerInspectorFactory()); runtime.setSourceLocation(limit.getSourceLocation()); builder.contributeMicroOperator(limit, runtime, recDesc); // and contribute one edge from its child ILogicalOperator src = limit.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, limit, 0); }
@Override public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { SelectOperator select = (SelectOperator) op; IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); IScalarEvaluatorFactory cond = expressionRuntimeProvider.createEvaluatorFactory( select.getCondition().getValue(), context.getTypeEnvironment(op), inputSchemas, context); StreamSelectRuntimeFactory runtime = new StreamSelectRuntimeFactory(cond, null, context.getBinaryBooleanInspectorFactory(), select.getRetainMissing(), inputSchemas[0].findVariable(select.getMissingPlaceholderVariable()), context.getMissingWriterFactory()); runtime.setSourceLocation(select.getSourceLocation()); // contribute one Asterix framewriter RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context); builder.contributeMicroOperator(select, runtime, recDesc); // and contribute one edge from its child ILogicalOperator src = select.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, select, 0); }
int outCol = opSchema.findVariable(unnest.getVariable()); ILogicalExpression unnestExpr = unnest.getExpressionRef().getValue(); IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); boolean exit = false; if (unnestExpr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
@Override public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException { SplitOperator sop = (SplitOperator) op; int outputArity = sop.getOutputArity(); int defaultBranch = sop.getDefaultBranch(); boolean propageToAllBranchAsDefault = sop.getPropageToAllBranchAsDefault(); IOperatorDescriptorRegistry spec = builder.getJobSpec(); RecordDescriptor recDescriptor = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context); IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); IScalarEvaluatorFactory brachingExprEvalFactory = expressionRuntimeProvider.createEvaluatorFactory( sop.getBranchingExpression().getValue(), context.getTypeEnvironment(op), inputSchemas, context); IBinaryIntegerInspectorFactory intInsepctorFactory = context.getBinaryIntegerInspectorFactory(); SplitOperatorDescriptor sopDesc = new SplitOperatorDescriptor(spec, recDescriptor, outputArity, brachingExprEvalFactory, intInsepctorFactory, defaultBranch, propageToAllBranchAsDefault); sopDesc.setSourceLocation(sop.getSourceLocation()); contributeOpDesc(builder, sop, sopDesc); ILogicalOperator src = op.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, op, 0); } }
ISerializedAggregateEvaluatorFactory[] aff = new ISerializedAggregateEvaluatorFactory[n]; int i = 0; IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); ILogicalOperator aggOpInput = aggOp.getInputs().get(0).getValue(); IOperatorSchema aggOpInputSchema = context.getSchema(aggOpInput);
IAggregateEvaluatorFactory[] aff = new IAggregateEvaluatorFactory[n]; int i = 0; IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); IVariableTypeEnvironment aggOpInputEnv = context.getTypeEnvironment(aggOp.getInputs().get(0).getValue()); IVariableTypeEnvironment outputEnv = context.getTypeEnvironment(op);
IOperatorSchema[] conditionInputSchemas = new IOperatorSchema[1]; conditionInputSchemas[0] = propagatedSchema; IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider(); IScalarEvaluatorFactory cond = expressionRuntimeProvider.createEvaluatorFactory(join.getCondition().getValue(), context.getTypeEnvironment(op), conditionInputSchemas, context);
IExpressionRuntimeProvider exprRuntimeProvider = context.getExpressionRuntimeProvider(); IBinaryComparatorFactoryProvider binaryComparatorFactoryProvider = context.getBinaryComparatorFactoryProvider();
IScalarEvaluatorFactory fact = jobGenCtx.getExpressionRuntimeProvider().createEvaluatorFactory(expr, _emptyTypeEnv, _emptySchemas, jobGenCtx);