brickhouse.udf.date
Class DateRangeUDTF

java.lang.Object
  extended by org.apache.hadoop.hive.ql.udf.generic.GenericUDTF
      extended by brickhouse.udf.date.DateRangeUDTF

public class DateRangeUDTF
extends org.apache.hadoop.hive.ql.udf.generic.GenericUDTF

DateRange is a UDTF for generating days from start date to end_date, inclusively. This might be useful in cases where one needed to have a row for every day in the range ... select t1.id, t1.date, coalesce( t2.val, 0.0 ) as val from ( select id, rng.date from tab1 lateral view( date_range( tab1.start_date, tab1.end_date ) ) rng as date, index ) t1 left outer join ( select val from tab2 ) t2 on ( t1.id = t2.id and t1.date = t2.date );


Constructor Summary
DateRangeUDTF()
           
 
Method Summary
 void close()
           
 org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector initialize(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector[] argOIs)
           
 void process(Object[] args)
           
 
Methods inherited from class org.apache.hadoop.hive.ql.udf.generic.GenericUDTF
forward, setCollector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateRangeUDTF

public DateRangeUDTF()
Method Detail

initialize

public org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector initialize(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector[] argOIs)
                                                                               throws org.apache.hadoop.hive.ql.exec.UDFArgumentException
Specified by:
initialize in class org.apache.hadoop.hive.ql.udf.generic.GenericUDTF
Throws:
org.apache.hadoop.hive.ql.exec.UDFArgumentException

process

public void process(Object[] args)
             throws org.apache.hadoop.hive.ql.metadata.HiveException
Specified by:
process in class org.apache.hadoop.hive.ql.udf.generic.GenericUDTF
Throws:
org.apache.hadoop.hive.ql.metadata.HiveException

close

public void close()
           throws org.apache.hadoop.hive.ql.metadata.HiveException
Specified by:
close in class org.apache.hadoop.hive.ql.udf.generic.GenericUDTF
Throws:
org.apache.hadoop.hive.ql.metadata.HiveException


Copyright © 2013. All rights reserved.