org.apache.hadoop.hive.ql.udf.generic
Class GenericUDTF

java.lang.Object
  extended by org.apache.hadoop.hive.ql.udf.generic.GenericUDTF
Direct Known Subclasses:
GenericUDTFExplode

public abstract class GenericUDTF
extends Object

A Generic User-defined Table Generating Function (UDTF) Generates a variable number of output rows for a single input row. Useful for explode(array)...


Constructor Summary
GenericUDTF()
           
 
Method Summary
abstract  void close()
          Called to notify the UDTF that there are no more rows to process.
protected  void forward(Object o)
          Passes an output row to the collector.
abstract  StructObjectInspector initialize(ObjectInspector[] argOIs)
          Initialize this GenericUDTF.
abstract  void process(Object[] args)
          Give a set of arguments for the UDTF to process.
 void setCollector(Collector collector)
          Associates a collector with this UDTF.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericUDTF

public GenericUDTF()
Method Detail

initialize

public abstract StructObjectInspector initialize(ObjectInspector[] argOIs)
                                          throws UDFArgumentException
Initialize this GenericUDTF. This will be called only once per instance.

Parameters:
args - An array of ObjectInspectors for the arguments
Returns:
A StructObjectInspector for output. The output struct represents a row of the table where the fields of the stuct are the columns. The field names are unimportant as they will be overridden by user supplied column aliases.
Throws:
UDFArgumentException

process

public abstract void process(Object[] args)
                      throws HiveException
Give a set of arguments for the UDTF to process.

Parameters:
o - object array of arguments
Throws:
HiveException

close

public abstract void close()
                    throws HiveException
Called to notify the UDTF that there are no more rows to process. Note that forward() should not be called in this function. Only clean up code should be run.

Throws:
HiveException

setCollector

public final void setCollector(Collector collector)
Associates a collector with this UDTF. Can't be specified in the constructor as the UDTF may be initialized before the collector has been constructed.

Parameters:
collector -

forward

protected final void forward(Object o)
                      throws HiveException
Passes an output row to the collector.

Parameters:
o -
Throws:
HiveException


Copyright © 2010 The Apache Software Foundation