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

java.lang.Object
  extended by org.apache.hadoop.hive.ql.udf.ptf.TableFunctionResolver
Direct Known Subclasses:
MatchPath.MatchPathResolver, Noop.NoopResolver, NoopWithMap.NoopWithMapResolver, WindowingTableFunction.WindowingTableFunctionResolver

public abstract class TableFunctionResolver
extends Object

Based on Hive GenericUDAFResolver. Break up the responsibility of the old AbstractTableFunction class into a Resolver and Evaluator. The Resolver is responsible for:

  1. setting up the tableFunctionEvaluator
  2. Setting up the The raw and output ObjectInspectors of the Evaluator.
  3. The Evaluator also holds onto the TableFunctionDef. This provides information about the arguments to the function, the shape of the Input partition and the Partitioning details.
The Resolver for a function is obtained from the FunctionRegistry. The Resolver is initialized by the following 4 step process:
  1. The initialize method is called; which is passed the PTFDesc and the TableFunctionDef.
  2. The resolver is then asked to setup the Raw ObjectInspector. This is only required if the Function reshapes the raw input.
  3. Once the Resolver has had a chance to compute the shape of the Raw Input that is fed to the partitioning machinery; the translator sets up the partitioning details on the tableFuncDef.
  4. finally the resolver is asked to setup the output ObjectInspector.


Constructor Summary
TableFunctionResolver()
           
 
Method Summary
 boolean carryForwardNames()
           
protected abstract  TableFunctionEvaluator createEvaluator(PTFDesc ptfDesc, PTFDesc.PartitionedTableFunctionDef tDef)
           
 TableFunctionEvaluator getEvaluator()
           
abstract  ArrayList<String> getOutputColumnNames()
           
 PTFDesc getPtfDesc()
           
 ArrayList<String> getRawInputColumnNames()
           
 void initialize(HiveConf cfg, PTFDesc ptfDesc, PTFDesc.PartitionedTableFunctionDef tDef)
           
 void initialize(PTFDesc ptfDesc, PTFDesc.PartitionedTableFunctionDef tDef, TableFunctionEvaluator evaluator)
           
abstract  void initializeOutputOI()
          This method is invoked during runtime(during deserialization of theQueryDef).
 void initializeRawInputOI()
           
protected  void setOutputOI(StructObjectInspector outputOI)
           
protected  void setRawInputOI(StructObjectInspector rawInputOI)
           
abstract  void setupOutputOI()
           
 void setupRawInputOI()
           
abstract  boolean transformsRawInput()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableFunctionResolver

public TableFunctionResolver()
Method Detail

initialize

public void initialize(HiveConf cfg,
                       PTFDesc ptfDesc,
                       PTFDesc.PartitionedTableFunctionDef tDef)
                throws SemanticException
Throws:
SemanticException

initialize

public void initialize(PTFDesc ptfDesc,
                       PTFDesc.PartitionedTableFunctionDef tDef,
                       TableFunctionEvaluator evaluator)
                throws HiveException
Throws:
HiveException

getEvaluator

public TableFunctionEvaluator getEvaluator()

setupOutputOI

public abstract void setupOutputOI()
                            throws SemanticException
Throws:
SemanticException

getOutputColumnNames

public abstract ArrayList<String> getOutputColumnNames()
                                                throws SemanticException
Throws:
SemanticException

initializeOutputOI

public abstract void initializeOutputOI()
                                 throws HiveException
This method is invoked during runtime(during deserialization of theQueryDef). At this point the TableFunction can assume that the Expression Nodes exist for all the Def (ArgDef, ColumnDef, WindowDef..). It is the responsibility of the TableFunction to construct the evaluators and setup the OI.

Parameters:
tblFuncDef -
ptfDesc -
Throws:
HiveException

setupRawInputOI

public void setupRawInputOI()
                     throws SemanticException
Throws:
SemanticException

getRawInputColumnNames

public ArrayList<String> getRawInputColumnNames()
                                         throws SemanticException
Throws:
SemanticException

initializeRawInputOI

public void initializeRawInputOI()
                          throws HiveException
Throws:
HiveException

setRawInputOI

protected void setRawInputOI(StructObjectInspector rawInputOI)

setOutputOI

protected void setOutputOI(StructObjectInspector outputOI)

getPtfDesc

public PTFDesc getPtfDesc()

carryForwardNames

public boolean carryForwardNames()

transformsRawInput

public abstract boolean transformsRawInput()

createEvaluator

protected abstract TableFunctionEvaluator createEvaluator(PTFDesc ptfDesc,
                                                          PTFDesc.PartitionedTableFunctionDef tDef)


Copyright © 2012 The Apache Software Foundation