org.apache.pig.impl.plan.optimizer
Class PlanOptimizer<O extends Operator,P extends OperatorPlan<O>>

java.lang.Object
  extended by org.apache.pig.impl.plan.optimizer.PlanOptimizer<O,P>
Direct Known Subclasses:
FunctionalLogicalOptimizer, LogicalOptimizer

public abstract class PlanOptimizer<O extends Operator,P extends OperatorPlan<O>>
extends Object

A class to optimize plans. This class need not be subclassed for a particular type of plan. It can be instantiated with a set of Rules and then optimize called.


Field Summary
protected  int mMaxIterations
           
protected  P mPlan
           
protected  List<Rule<O,P>> mRules
           
 
Constructor Summary
protected PlanOptimizer(P plan)
           
protected PlanOptimizer(P plan, int iterations)
           
 
Method Summary
 void optimize()
          Run the optimizer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mRules

protected List<Rule<O extends Operator,P extends OperatorPlan<O>>> mRules

mPlan

protected P extends OperatorPlan<O> mPlan

mMaxIterations

protected int mMaxIterations
Constructor Detail

PlanOptimizer

protected PlanOptimizer(P plan)
Parameters:
plan - Plan to optimize

PlanOptimizer

protected PlanOptimizer(P plan,
                        int iterations)
Parameters:
plan - Plan to optimize
iterations - maximum number of optimization iterations
Method Detail

optimize

public void optimize()
              throws OptimizerException
Run the optimizer. This method attempts to match each of the Rules against the plan. If a Rule matches, it then calls the check method of the associated Transformer to give the it a chance to check whether it really wants to do the optimization. If that returns true as well, then Transformer.transform is called.

Throws:
OptimizerException


Copyright © ${year} The Apache Software Foundation