org.apache.hadoop.hive.ql.lib
Class RuleExactMatch

java.lang.Object
  extended by 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.
 
Method Summary
 int cost(Stack<Node> stack)
          This function returns the cost of the rule for the specified stack.
 String getName()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 rule
regExp - string specification of the rule
Method Detail

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.