org.apache.hadoop.hive.ql.udf.ptf
Class TableFunctionResolver
java.lang.Object
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:
- setting up the
tableFunctionEvaluator
- Setting up the The raw and output ObjectInspectors of the Evaluator.
- 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:
- The initialize method is called; which is passed the
PTFDesc
and the TableFunctionDef
.
- The resolver is then asked to setup the Raw ObjectInspector. This is only required if the Function reshapes
the raw input.
- 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.
- finally the resolver is asked to setup the output ObjectInspector.
TableFunctionResolver
public TableFunctionResolver()
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.