org.apache.hadoop.hive.ql.udf
Class UDFDateDiff

java.lang.Object
  extended by org.apache.hadoop.hive.ql.exec.UDF
      extended by org.apache.hadoop.hive.ql.udf.UDFDateDiff

public class UDFDateDiff
extends UDF

UDFDateDiff.


Constructor Summary
UDFDateDiff()
           
 
Method Summary
 org.apache.hadoop.io.IntWritable evaluate(org.apache.hadoop.io.Text dateString1, org.apache.hadoop.io.Text dateString2)
          Calculate the difference in the number of days.
 org.apache.hadoop.io.IntWritable evaluate(org.apache.hadoop.io.Text dateString, TimestampWritable t)
           
 org.apache.hadoop.io.IntWritable evaluate(TimestampWritable t, org.apache.hadoop.io.Text dateString)
           
 org.apache.hadoop.io.IntWritable evaluate(TimestampWritable t1, TimestampWritable t2)
           
 
Methods inherited from class org.apache.hadoop.hive.ql.exec.UDF
getRequiredFiles, getRequiredJars, getResolver, setResolver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDFDateDiff

public UDFDateDiff()
Method Detail

evaluate

public org.apache.hadoop.io.IntWritable evaluate(org.apache.hadoop.io.Text dateString1,
                                                 org.apache.hadoop.io.Text dateString2)
Calculate the difference in the number of days. The time part of the string will be ignored. If dateString1 is earlier than dateString2, then the result can be negative.

Parameters:
dateString1 - the date string in the format of "yyyy-MM-dd HH:mm:ss" or "yyyy-MM-dd".
dateString2 - the date string in the format of "yyyy-MM-dd HH:mm:ss" or "yyyy-MM-dd".
Returns:
the difference in days.

evaluate

public org.apache.hadoop.io.IntWritable evaluate(TimestampWritable t1,
                                                 TimestampWritable t2)

evaluate

public org.apache.hadoop.io.IntWritable evaluate(TimestampWritable t,
                                                 org.apache.hadoop.io.Text dateString)

evaluate

public org.apache.hadoop.io.IntWritable evaluate(org.apache.hadoop.io.Text dateString,
                                                 TimestampWritable t)


Copyright © 2013 The Apache Software Foundation