org.apache.hadoop.hive.ql.lib
Class RuleExactMatch
java.lang.Object
org.apache.hadoop.hive.ql.lib.RuleExactMatch
- All Implemented Interfaces:
- Rule
public class RuleExactMatch
- extends Object
- implements Rule
Implentation of the Rule interface for Nodes Used in Node dispatching to dispatch
process/visitor functions for Nodes. The cost method returns 1 if there is an exact
match between the expression and the stack, otherwise -1.
Constructor Summary |
RuleExactMatch(String ruleName,
String pattern)
The rule specified as operator names separated by % symbols, the left side represents the
bottom of the stack. |
RuleExactMatch
public RuleExactMatch(String ruleName,
String pattern)
- The rule specified as operator names separated by % symbols, the left side represents the
bottom of the stack.
E.g. TS%FIL%RS -> means
TableScan Node followed by Filter followed by ReduceSink in the tree, or, in terms of the
stack, ReduceSink on top followed by Filter followed by TableScan
- Parameters:
ruleName
- name of the ruleregExp
- string specification of the rule
cost
public int cost(Stack<Node> stack)
throws SemanticException
- This function returns the cost of the rule for the specified stack. Returns 1 if there is
an exact match with the entire stack, otherwise -1
If any proper substack of the stack matches it will return -1. It only returns 1 if the
entire stack matches the rule exactly.
- Specified by:
cost
in interface Rule
- Parameters:
stack
- Node stack encountered so far
- Returns:
- cost of the function
- Throws:
SemanticException
getName
public String getName()
- Specified by:
getName
in interface Rule
- Returns:
- the name of the Node
Copyright © 2014 The Apache Software Foundation. All rights reserved.