use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.
the class CommitPOperator method contributeRuntimeOperator.
@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, jobId, primaryKeyFields, isSink);
builder.contributeMicroOperator(op, runtime, recDesc);
ILogicalOperator src = op.getInputs().get(0).getValue();
builder.contributeGraphEdge(src, 0, op, 0);
}
use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.
the class CancelUnnestWithNestedListifyRule method applyRuleDown.
private boolean applyRuleDown(Mutable<ILogicalOperator> opRef, Set<LogicalVariable> varSet, IOptimizationContext context) throws AlgebricksException {
boolean changed = applies(opRef, varSet, context);
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
VariableUtilities.getUsedVariables(op, varSet);
if (op.hasNestedPlans()) {
AbstractOperatorWithNestedPlans aonp = (AbstractOperatorWithNestedPlans) op;
for (ILogicalPlan p : aonp.getNestedPlans()) {
for (Mutable<ILogicalOperator> r : p.getRoots()) {
if (applyRuleDown(r, varSet, context)) {
changed = true;
}
context.addToDontApplySet(this, r.getValue());
}
}
}
for (Mutable<ILogicalOperator> i : op.getInputs()) {
if (applyRuleDown(i, varSet, context)) {
changed = true;
}
context.addToDontApplySet(this, i.getValue());
}
return changed;
}
use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.
the class OperatorPropertiesUtil method collectUsedAndProducedVariablesInPath.
/**
* @param op
* , the start operator.
* @param dest
* , the destination operator (a direct/indirect input operator).
* @param usedVars
* , the collection of used variables.
* @param producedVars
* , the collection of produced variables.
* @return if the current operator is on the path from the original start operator to the destination operator.
* @throws AlgebricksException
*/
private static boolean collectUsedAndProducedVariablesInPath(ILogicalOperator op, ILogicalOperator dest, Set<LogicalVariable> usedVars, Set<LogicalVariable> producedVars) throws AlgebricksException {
if (op == dest) {
return true;
}
if (((AbstractLogicalOperator) op).hasNestedPlans()) {
AbstractOperatorWithNestedPlans a = (AbstractOperatorWithNestedPlans) op;
for (ILogicalPlan p : a.getNestedPlans()) {
for (Mutable<ILogicalOperator> r : p.getRoots()) {
if (collectUsedAndProducedVariablesInPath(r.getValue(), dest, usedVars, producedVars)) {
VariableUtilities.getUsedVariables(r.getValue(), usedVars);
VariableUtilities.getProducedVariables(r.getValue(), producedVars);
return true;
}
}
}
}
for (Mutable<ILogicalOperator> childRef : op.getInputs()) {
if (collectUsedAndProducedVariablesInPath(childRef.getValue(), dest, usedVars, producedVars)) {
VariableUtilities.getUsedVariables(op, usedVars);
VariableUtilities.getProducedVariables(op, producedVars);
return true;
}
}
return false;
}
use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.
the class OperatorPropertiesUtil method checkUnpartitionedAndGetPropertiesVector.
/**
* Checks whether a binary input operator in consideration needs to
* run in a single partition mode. If it does, returns an empty properties vector.
* Otherwise, returns the proposed partitioned properties vector.
*
* @param op, the binary input operator in consideration.
* @param partitionedPropertiesVector, the proposed partitioned properties vector.
* @return either an empty properties vector or the proposed partitioned properties vector.
*/
public static StructuralPropertiesVector checkUnpartitionedAndGetPropertiesVector(ILogicalOperator op, StructuralPropertiesVector partitionedPropertiesVector) {
ILogicalOperator leftChild = op.getInputs().get(0).getValue();
ILogicalOperator rightChild = op.getInputs().get(1).getValue();
boolean unPartitioned = leftChild.getExecutionMode().equals(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED) && rightChild.getExecutionMode().equals(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED);
return unPartitioned ? StructuralPropertiesVector.EMPTY_PROPERTIES_VECTOR : partitionedPropertiesVector;
}
use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.
the class JobBuilder method addMicroOpToMetaRuntimeOp.
private void addMicroOpToMetaRuntimeOp(ILogicalOperator aop) {
Integer k = algebraicOpBelongingToMetaAsterixOp.get(aop);
if (k == null) {
k = createNewMetaOpInfo(aop);
}
ArrayList<ILogicalOperator> destList = outEdges.get(aop);
if (destList == null || destList.size() != 1) {
// for now, we only support linear plans inside meta-ops.
return;
}
ILogicalOperator dest = destList.get(0);
Integer j = algebraicOpBelongingToMetaAsterixOp.get(dest);
if (j == null && microOps.get(dest) != null) {
algebraicOpBelongingToMetaAsterixOp.put(dest, k);
List<Pair<IPushRuntimeFactory, RecordDescriptor>> aodContent1 = metaAsterixOpSkeletons.get(k);
aodContent1.add(microOps.get(dest));
} else if (j != null && j.intValue() != k.intValue()) {
// merge the j component into the k component
List<Pair<IPushRuntimeFactory, RecordDescriptor>> aodContent1 = metaAsterixOpSkeletons.get(k);
List<Pair<IPushRuntimeFactory, RecordDescriptor>> aodContent2 = metaAsterixOpSkeletons.get(j);
aodContent1.addAll(aodContent2);
metaAsterixOpSkeletons.remove(j);
for (ILogicalOperator m : algebraicOpBelongingToMetaAsterixOp.keySet()) {
Integer g = algebraicOpBelongingToMetaAsterixOp.get(m);
if (g.intValue() == j.intValue()) {
algebraicOpBelongingToMetaAsterixOp.put(m, k);
}
}
}
}
Aggregations