Search in sources :

Example 1 with AbstractReplicateOperator

use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractReplicateOperator in project asterixdb by apache.

the class PlanCompiler method reviseEdges.

private void reviseEdges(IHyracksJobBuilder builder) {
    /**
         * revise the edges for the case of replicate operator
         */
    for (Entry<Mutable<ILogicalOperator>, List<Mutable<ILogicalOperator>>> entry : operatorVisitedToParents.entrySet()) {
        Mutable<ILogicalOperator> child = entry.getKey();
        List<Mutable<ILogicalOperator>> parents = entry.getValue();
        if (parents.size() > 1) {
            if (child.getValue().getOperatorTag() == LogicalOperatorTag.REPLICATE || child.getValue().getOperatorTag() == LogicalOperatorTag.SPLIT) {
                AbstractReplicateOperator rop = (AbstractReplicateOperator) child.getValue();
                if (rop.isBlocker()) {
                    // make the order of the graph edges consistent with the order of rop's outputs
                    List<Mutable<ILogicalOperator>> outputs = rop.getOutputs();
                    for (Mutable<ILogicalOperator> parent : parents) {
                        builder.contributeGraphEdge(child.getValue(), outputs.indexOf(parent), parent.getValue(), 0);
                    }
                } else {
                    int i = 0;
                    for (Mutable<ILogicalOperator> parent : parents) {
                        builder.contributeGraphEdge(child.getValue(), i, parent.getValue(), 0);
                        i++;
                    }
                }
            }
        }
    }
}
Also used : Mutable(org.apache.commons.lang3.mutable.Mutable) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) AbstractReplicateOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractReplicateOperator) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with AbstractReplicateOperator

use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractReplicateOperator in project asterixdb by apache.

the class AbstractReplicatePOperator method getInputOutputDependencyLabels.

@Override
public Pair<int[], int[]> getInputOutputDependencyLabels(ILogicalOperator op) {
    int[] inputDependencyLabels = new int[] { 0 };
    AbstractReplicateOperator rop = (AbstractReplicateOperator) op;
    int[] outputDependencyLabels = new int[rop.getOutputArity()];
    // change the labels of outputs that requires materialization to 1
    boolean[] outputMaterializationFlags = rop.getOutputMaterializationFlags();
    for (int i = 0; i < rop.getOutputArity(); i++) {
        if (outputMaterializationFlags[i]) {
            outputDependencyLabels[i] = 1;
        }
    }
    return new Pair<>(inputDependencyLabels, outputDependencyLabels);
}
Also used : AbstractReplicateOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractReplicateOperator) Pair(org.apache.hyracks.algebricks.common.utils.Pair)

Aggregations

AbstractReplicateOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractReplicateOperator)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Mutable (org.apache.commons.lang3.mutable.Mutable)1 Pair (org.apache.hyracks.algebricks.common.utils.Pair)1 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)1