Search in sources :

Example 6 with ILogicalOperator

use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.

the class JobBuilder method setSpecifiedPartitionConstraints.

private void setSpecifiedPartitionConstraints() {
    for (ILogicalOperator op : pcForMicroOps.keySet()) {
        AlgebricksPartitionConstraint pc = pcForMicroOps.get(op);
        Integer k = algebraicOpBelongingToMetaAsterixOp.get(op);
        AlgebricksMetaOperatorDescriptor amod = metaAsterixOps.get(k);
        partitionConstraintMap.put(amod, pc);
    }
    for (IOperatorDescriptor opDesc : partitionConstraintMap.keySet()) {
        AlgebricksPartitionConstraint pc = partitionConstraintMap.get(opDesc);
        AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(jobSpec, opDesc, pc);
    }
}
Also used : IOperatorDescriptor(org.apache.hyracks.api.dataflow.IOperatorDescriptor) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) AlgebricksMetaOperatorDescriptor(org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint)

Example 7 with ILogicalOperator

use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator 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 8 with ILogicalOperator

use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.

the class JobBuilder method buildSpec.

@Override
public void buildSpec(List<ILogicalOperator> roots) throws AlgebricksException {
    buildAsterixComponents();
    Map<IConnectorDescriptor, TargetConstraint> tgtConstraints = setupConnectors();
    for (ILogicalOperator r : roots) {
        IOperatorDescriptor opDesc = findOpDescForAlgebraicOp(r);
        jobSpec.addRoot(opDesc);
    }
    setAllPartitionConstraints(tgtConstraints);
}
Also used : IConnectorDescriptor(org.apache.hyracks.api.dataflow.IConnectorDescriptor) IOperatorDescriptor(org.apache.hyracks.api.dataflow.IOperatorDescriptor) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)

Example 9 with ILogicalOperator

use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.

the class OperatorPropertiesUtil method computeSchemaAndPropertiesRecIfNull.

public static void computeSchemaAndPropertiesRecIfNull(AbstractLogicalOperator op, IOptimizationContext context) throws AlgebricksException {
    if (op.getSchema() == null) {
        for (Mutable<ILogicalOperator> i : op.getInputs()) {
            computeSchemaAndPropertiesRecIfNull((AbstractLogicalOperator) i.getValue(), context);
        }
        if (op.hasNestedPlans()) {
            AbstractOperatorWithNestedPlans a = (AbstractOperatorWithNestedPlans) op;
            for (ILogicalPlan p : a.getNestedPlans()) {
                for (Mutable<ILogicalOperator> r : p.getRoots()) {
                    computeSchemaAndPropertiesRecIfNull((AbstractLogicalOperator) r.getValue(), context);
                }
            }
        }
        op.recomputeSchema();
        op.computeDeliveredPhysicalProperties(context);
    }
}
Also used : ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) ILogicalPlan(org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan) AbstractOperatorWithNestedPlans(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans)

Example 10 with ILogicalOperator

use of org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator in project asterixdb by apache.

the class OperatorPropertiesUtil method getFreeVariablesInSelfOrDesc.

/**
     * Adds the free variables of the plan rooted at that operator to the
     * collection provided.
     *
     * @param op
     * @param vars
     *            - The collection to which the free variables will be added.
     */
public static void getFreeVariablesInSelfOrDesc(AbstractLogicalOperator op, Set<LogicalVariable> freeVars) throws AlgebricksException {
    HashSet<LogicalVariable> produced = new HashSet<>();
    VariableUtilities.getProducedVariables(op, produced);
    for (LogicalVariable v : produced) {
        freeVars.remove(v);
    }
    HashSet<LogicalVariable> used = new HashSet<>();
    VariableUtilities.getUsedVariables(op, used);
    for (LogicalVariable v : used) {
        freeVars.add(v);
    }
    if (op.hasNestedPlans()) {
        AbstractOperatorWithNestedPlans s = (AbstractOperatorWithNestedPlans) op;
        getFreeVariablesInSubplans(s, freeVars);
    }
    for (Mutable<ILogicalOperator> i : op.getInputs()) {
        getFreeVariablesInSelfOrDesc((AbstractLogicalOperator) i.getValue(), freeVars);
    }
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) HashSet(java.util.HashSet) AbstractOperatorWithNestedPlans(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans)

Aggregations

ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)355 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)196 ILogicalExpression (org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression)130 Mutable (org.apache.commons.lang3.mutable.Mutable)125 ArrayList (java.util.ArrayList)119 AbstractLogicalOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator)117 VariableReferenceExpression (org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression)86 ILogicalPlan (org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan)73 AssignOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AssignOperator)57 Pair (org.apache.hyracks.algebricks.common.utils.Pair)53 MutableObject (org.apache.commons.lang3.mutable.MutableObject)51 HashSet (java.util.HashSet)46 AbstractFunctionCallExpression (org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression)43 ScalarFunctionCallExpression (org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression)36 GroupByOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator)36 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)33 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)29 AggregateOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator)28 SubplanOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.SubplanOperator)26 AggregateFunctionCallExpression (org.apache.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression)25