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:
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()
           
 TableFunctionEvaluator getEvaluator()
           
abstract  List<String> getOutputColumnNames()
           
 PTFDesc getPtfDesc()
           
 List<String> getRawInputColumnNames()
           
 void initialize(HiveConf cfg, PTFDesc ptfDesc, PartitionedTableFunctionDef tDef)
           
 void initialize(PTFDesc ptfDesc, PartitionedTableFunctionDef tDef, TableFunctionEvaluator evaluator)
           
abstract  void initializeOutputOI()
          This method is invoked during runtime(during deserialization of theQueryDef).
 void initializeRawInputOI()
           
abstract  void setupOutputOI()
           
 void setupRawInputOI()
           
abstract  boolean transformsRawInput()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableFunctionResolver

public TableFunctionResolver()
Method Detail

initialize

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

initialize

public void initialize(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 List<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 List<String> getRawInputColumnNames()
                                    throws SemanticException
Throws:
SemanticException

initializeRawInputOI

public void initializeRawInputOI()
                          throws HiveException
Throws:
HiveException

getPtfDesc

public PTFDesc getPtfDesc()

carryForwardNames

public boolean carryForwardNames()

transformsRawInput

public abstract boolean transformsRawInput()


Copyright © 2014 The Apache Software Foundation. All rights reserved.