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, GenericUDTFInline, GenericUDTFJSONTuple, GenericUDTFParseUrlTuple, GenericUDTFPosExplode, GenericUDTFStack

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.
 void configure(MapredContext mapredContext)
          Additionally setup GenericUDTF with MapredContext before initializing.
 StructObjectInspector initialize(ObjectInspector[] argOIs)
          Deprecated. 
 StructObjectInspector initialize(StructObjectInspector argOIs)
           
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericUDTF

public GenericUDTF()
Method Detail

configure

public void configure(MapredContext mapredContext)
Additionally setup GenericUDTF with MapredContext before initializing. This is only called in runtime of MapRedTask.

Parameters:
context - context

initialize

public StructObjectInspector initialize(StructObjectInspector argOIs)
                                 throws UDFArgumentException
Throws:
UDFArgumentException

initialize

@Deprecated
public StructObjectInspector initialize(ObjectInspector[] argOIs)
                                 throws UDFArgumentException
Deprecated. 

Initialize this GenericUDTF. This will be called only once per instance.

Parameters:
argOIs - 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:
args - 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. Clean up code or additional forward() calls can be made here.

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 -


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