org.apache.hadoop.hive.ql.udf.ptf
Class MatchPath

java.lang.Object
  extended by org.apache.hadoop.hive.ql.udf.ptf.TableFunctionEvaluator
      extended by org.apache.hadoop.hive.ql.udf.ptf.MatchPath

public class MatchPath
extends TableFunctionEvaluator

return rows that meet a specified pattern. Use symbols to specify a list of expressions to match. Pattern is used to specify a Path. The results list can contain expressions based on the input columns and also the matched Path.

  1. pattern: pattern for the Path. Path is 'dot' separated list of symbols. Each element is treated as a symbol. Elements that end in '*' or '+' are interpreted with the usual meaning of zero or more, one or more respectively. For e.g. "LATE.EARLY*.ONTIMEOREARLY" implies a sequence of flights where the first occurrence was LATE, followed by zero or more EARLY flights, followed by a ONTIME or EARLY flight.
  2. symbols specify a list of name, expression pairs. For e.g. 'LATE', arrival_delay > 0, 'EARLY', arrival_delay < 0 , 'ONTIME', arrival_delay == 0. These symbols can be used in the Pattern defined above.
  3. resultSelectList specified as a select list. The expressions in the selectList are evaluated in the context where all the input columns are available, plus the attribute "tpath" is available. Path is a collection of rows that represents the matching Path.


Nested Class Summary
static class MatchPath.Chain
           
static class MatchPath.MatchPathResolver
           
static class MatchPath.Plus
           
static class MatchPath.ResultExpressionParser
           
static class MatchPath.ResultExprInfo
           
static class MatchPath.Star
           
static class MatchPath.Symbol
           
static class MatchPath.SymbolFunction
           
static class MatchPath.SymbolFunctionResult
           
static class MatchPath.SymbolParser
           
 
Field Summary
static String PATHATTR_NAME
           
 
Fields inherited from class org.apache.hadoop.hive.ql.udf.ptf.TableFunctionEvaluator
OI, outputPartition, ptfDesc, rawInputOI, tDef
 
Constructor Summary
MatchPath()
           
 
Method Summary
protected static StructObjectInspector createSelectListOI(MatchPath evaluator, PTFDesc.PTFInputDef inpDef)
           
protected static RowResolver createSelectListRR(MatchPath evaluator, PTFDesc.PTFInputDef inpDef)
           
 void execute(PTFPartition.PTFPartitionIterator<Object> pItr, PTFPartition outP)
           
 HashMap<String,String> getInputColumnNames()
           
static ArrayList<Object> getPath(Object currRow, ObjectInspector rowOI, PTFPartition.PTFPartitionIterator<Object> pItr, int sz)
           
 MatchPath.ResultExprInfo getResultExprInfo()
           
static Object getSelectListInput(Object currRow, ObjectInspector rowOI, PTFPartition.PTFPartitionIterator<Object> pItr, int sz)
           
 void setInputColumnNames(HashMap<String,String> inputColumnNamesMap)
           
 void setResultExprInfo(MatchPath.ResultExprInfo resultExprInfo)
           
 
Methods inherited from class org.apache.hadoop.hive.ql.udf.ptf.TableFunctionEvaluator
_transformRawInput, execute, getOutputOI, getQueryDef, getRawInputOI, getTableDef, isTransformsRawInput, setOutputOI, setQueryDef, setRawInputOI, setTableDef, setTransformsRawInput, transformRawInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATHATTR_NAME

public static final String PATHATTR_NAME
See Also:
Constant Field Values
Constructor Detail

MatchPath

public MatchPath()
Method Detail

execute

public void execute(PTFPartition.PTFPartitionIterator<Object> pItr,
                    PTFPartition outP)
             throws HiveException
Specified by:
execute in class TableFunctionEvaluator
Throws:
HiveException

getInputColumnNames

public HashMap<String,String> getInputColumnNames()

setInputColumnNames

public void setInputColumnNames(HashMap<String,String> inputColumnNamesMap)

getResultExprInfo

public MatchPath.ResultExprInfo getResultExprInfo()

setResultExprInfo

public void setResultExprInfo(MatchPath.ResultExprInfo resultExprInfo)

createSelectListRR

protected static RowResolver createSelectListRR(MatchPath evaluator,
                                                PTFDesc.PTFInputDef inpDef)
                                         throws SemanticException
Throws:
SemanticException

createSelectListOI

protected static StructObjectInspector createSelectListOI(MatchPath evaluator,
                                                          PTFDesc.PTFInputDef inpDef)

getSelectListInput

public static Object getSelectListInput(Object currRow,
                                        ObjectInspector rowOI,
                                        PTFPartition.PTFPartitionIterator<Object> pItr,
                                        int sz)
                                 throws HiveException
Throws:
HiveException

getPath

public static ArrayList<Object> getPath(Object currRow,
                                        ObjectInspector rowOI,
                                        PTFPartition.PTFPartitionIterator<Object> pItr,
                                        int sz)
                                 throws HiveException
Throws:
HiveException


Copyright © 2012 The Apache Software Foundation