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

java.lang.Object
  extended by org.apache.pig.impl.plan.optimizer.Rule<O,P>

public class Rule<O extends Operator,P extends OperatorPlan<O>>
extends Object

A rule for optimizing a plan. The rule contains a pattern that must be matched in the plan before the optimizer can consider applying the rule and a transformer to do further checks and possibly transform the plan. The rule pattern is expressed as a list of node names, a map of edges in the plan, and a list of boolean values indicating whether the node is required. For example, a rule pattern could be expressed as: [Filter, Filter] {[0, 1]} [true, true], which would indicate this rule matches two nodes of class name Filter, with an edge between the two, and both are required.


Nested Class Summary
static class Rule.WalkerAlgo
           
 
Field Summary
 Rule.WalkerAlgo algo
           
 Map<Integer,Integer> edges
           
 List<String> nodes
           
 List<Boolean> required
           
 Transformer<O,P> transformer
           
 
Constructor Summary
Rule(List<String> n, Map<Integer,Integer> e, List<Boolean> r, Transformer<O,P> t)
           
Rule(List<String> n, Map<Integer,Integer> e, List<Boolean> r, Transformer<O,P> t, Rule.WalkerAlgo al)
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodes

public List<String> nodes

edges

public Map<Integer,Integer> edges

required

public List<Boolean> required

transformer

public Transformer<O extends Operator,P extends OperatorPlan<O>> transformer

algo

public Rule.WalkerAlgo algo
Constructor Detail

Rule

public Rule(List<String> n,
            Map<Integer,Integer> e,
            List<Boolean> r,
            Transformer<O,P> t,
            Rule.WalkerAlgo al)
Parameters:
n - List of node types to look for.
e - Map of integers to integers. Each integer represents the offset into nodes list.
r - List of boolean indicating whether given nodes are required for the pattern to match.
t - Transformer to apply if the rule matches.
al - Walker algorithm to find rule match within the plan.

Rule

public Rule(List<String> n,
            Map<Integer,Integer> e,
            List<Boolean> r,
            Transformer<O,P> t)


Copyright © ${year} The Apache Software Foundation