use of org.apache.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint in project asterixdb by apache.
the class AbstractPhysicalOperator method contributeOpDesc.
protected void contributeOpDesc(IHyracksJobBuilder builder, AbstractLogicalOperator op, IOperatorDescriptor opDesc) {
if (op.getExecutionMode() == ExecutionMode.UNPARTITIONED) {
AlgebricksPartitionConstraint apc = new AlgebricksCountPartitionConstraint(1);
builder.contributeAlgebricksPartitionConstraint(opDesc, apc);
}
builder.contributeHyracksOperator(op, opDesc);
}
use of org.apache.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint in project asterixdb by apache.
the class AssignPOperator method contributeRuntimeOperator.
@Override
public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException {
AssignOperator assign = (AssignOperator) op;
List<LogicalVariable> variables = assign.getVariables();
List<Mutable<ILogicalExpression>> expressions = assign.getExpressions();
int[] outColumns = new int[variables.size()];
for (int i = 0; i < outColumns.length; i++) {
outColumns[i] = opSchema.findVariable(variables.get(i));
}
IScalarEvaluatorFactory[] evalFactories = new IScalarEvaluatorFactory[expressions.size()];
IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider();
for (int i = 0; i < evalFactories.length; i++) {
evalFactories[i] = expressionRuntimeProvider.createEvaluatorFactory(expressions.get(i).getValue(), context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas, context);
}
// TODO push projections into the operator
int[] projectionList = JobGenHelper.projectAllVariables(opSchema);
AssignRuntimeFactory runtime = new AssignRuntimeFactory(outColumns, evalFactories, projectionList, flushFramesRapidly);
// contribute one Asterix framewriter
RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context);
if (cardinalityConstraint > 0) {
AlgebricksCountPartitionConstraint countConstraint = new AlgebricksCountPartitionConstraint(cardinalityConstraint);
builder.contributeMicroOperator(assign, runtime, recDesc, countConstraint);
} else {
builder.contributeMicroOperator(assign, runtime, recDesc);
}
// and contribute one edge from its child
ILogicalOperator src = assign.getInputs().get(0).getValue();
builder.contributeGraphEdge(src, 0, assign, 0);
}
use of org.apache.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint in project asterixdb by apache.
the class JobBuilder method contributeAlgebricksPartitionConstraint.
@Override
public void contributeAlgebricksPartitionConstraint(IOperatorDescriptor opDesc, AlgebricksPartitionConstraint apcArg) {
AlgebricksPartitionConstraint apc = apcArg;
if (apc.getPartitionConstraintType() == PartitionConstraintType.COUNT) {
AlgebricksCountPartitionConstraint constraint = (AlgebricksCountPartitionConstraint) apc;
if (constraint.getCount() == 1) {
apc = countOneLocation;
}
}
partitionConstraintMap.put(opDesc, apc);
}
Aggregations