org.apache.hadoop.hive.ql.udf.ptf
Class MatchPath
java.lang.Object
org.apache.hadoop.hive.ql.udf.ptf.TableFunctionEvaluator
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.
- 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.
- 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.
- 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.
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 |
PATHATTR_NAME
public static final String PATHATTR_NAME
- See Also:
- Constant Field Values
MatchPath
public MatchPath()
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