Search in sources :

Example 1 with RequiredCapacityVisitor

use of org.apache.asterix.app.resource.RequiredCapacityVisitor in project asterixdb by apache.

the class ResourceUtils method getRequiredCompacity.

/**
     * Calculates the required cluster capacity from a given query plan, the computation locations,
     * the operator memory budgets, and frame size.
     *
     * @param plan,
     *            a given query plan.
     * @param computationLocations,
     *            the partitions for computation.
     * @param sortFrameLimit,
     *            the frame limit for one sorter partition.
     * @param groupFrameLimit,
     *            the frame limit for one group-by partition.
     * @param joinFrameLimit
     *            the frame limit for one joiner partition.
     * @param frameSize
     *            the frame size used in query execution.
     * @return the required cluster capacity for executing the query.
     * @throws AlgebricksException
     *             if the query plan is malformed.
     */
public static IClusterCapacity getRequiredCompacity(ILogicalPlan plan, AlgebricksAbsolutePartitionConstraint computationLocations, int sortFrameLimit, int groupFrameLimit, int joinFrameLimit, int frameSize) throws AlgebricksException {
    // Creates a cluster capacity visitor.
    IClusterCapacity clusterCapacity = new ClusterCapacity();
    RequiredCapacityVisitor visitor = new RequiredCapacityVisitor(computationLocations.getLocations().length, sortFrameLimit, groupFrameLimit, joinFrameLimit, frameSize, clusterCapacity);
    // There could be only one root operator for a top-level query plan.
    ILogicalOperator rootOp = plan.getRoots().get(0).getValue();
    rootOp.accept(visitor, null);
    return clusterCapacity;
}
Also used : IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) ClusterCapacity(org.apache.hyracks.api.job.resource.ClusterCapacity) IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) RequiredCapacityVisitor(org.apache.asterix.app.resource.RequiredCapacityVisitor)

Aggregations

RequiredCapacityVisitor (org.apache.asterix.app.resource.RequiredCapacityVisitor)1 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)1 ClusterCapacity (org.apache.hyracks.api.job.resource.ClusterCapacity)1 IClusterCapacity (org.apache.hyracks.api.job.resource.IClusterCapacity)1