|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.newplan.optimizer.Rule
public abstract class Rule
Rules describe a pattern of operators. They also reference a Transformer. If the pattern of operators is found one or more times in the provided plan, then the optimizer will use the associated Transformer to transform the plan. Note: the pattern matching logic implemented here has a limitation that it assumes that all the leaves in the pattern are siblings. See more detailed description here - https://issues.apache.org/jira/browse/PIG-1742 If new rules use patterns that don't work with this limitation, the pattern match logic will need to be updated.
Field Summary | |
---|---|
protected OperatorPlan |
currentPlan
|
protected static org.apache.commons.logging.Log |
log
|
protected String |
name
|
protected OperatorPlan |
pattern
|
Constructor Summary | |
---|---|
Rule(String n,
boolean mandatory)
Create this rule by using the default pattern that this rule provided |
|
Rule(String n,
OperatorPlan p)
|
Method Summary | |
---|---|
protected abstract OperatorPlan |
buildPattern()
Build the pattern that this rule will look for |
String |
getName()
|
abstract Transformer |
getNewTransformer()
Get the transformer for this rule. |
OperatorPlan |
getPattern()
Return the pattern to be matched for this rule |
boolean |
isMandatory()
|
protected boolean |
isSkipListener()
|
List<OperatorPlan> |
match(OperatorPlan plan)
Search for all the sub-plans that matches the pattern defined by this rule. |
protected void |
setSkipListener(boolean skip)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String name
protected OperatorPlan pattern
protected transient OperatorPlan currentPlan
protected static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public Rule(String n, boolean mandatory)
n
- Name of this rulemandatory
- if it is set to false, this rule can be disabled by userpublic Rule(String n, OperatorPlan p)
n
- Name of this rulep
- Pattern to look for.Method Detail |
---|
protected abstract OperatorPlan buildPattern()
public abstract Transformer getNewTransformer()
public OperatorPlan getPattern()
protected boolean isSkipListener()
protected void setSkipListener(boolean skip)
public List<OperatorPlan> match(OperatorPlan plan) throws FrontendException
plan
- the OperatorPlan to look for matches to the pattern
FrontendException
public String getName()
public boolean isMandatory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |