org.apache.hadoop.hive.serde2.io
Class DateWritable
java.lang.Object
org.apache.hadoop.hive.serde2.io.DateWritable
- All Implemented Interfaces:
- Comparable<DateWritable>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<DateWritable>
public class DateWritable
- extends Object
- implements org.apache.hadoop.io.WritableComparable<DateWritable>
DateWritable
Writable equivalent of java.sql.Date.
Dates are of the format
YYYY-MM-DD
DateWritable
public DateWritable()
DateWritable
public DateWritable(DateWritable d)
DateWritable
public DateWritable(Date d)
DateWritable
public DateWritable(int d)
set
public void set(int d)
- Set the DateWritable based on the days since epoch date.
- Parameters:
d
- integer value representing days since epoch date
set
public void set(Date d)
- Set the DateWritable based on the year/month/day of the date in the local timezone.
- Parameters:
d
- Date value
set
public void set(DateWritable d)
get
public Date get()
- Returns:
- Date value corresponding to the date in the local time zone
getDays
public int getDays()
getTimeInSeconds
public long getTimeInSeconds()
- Returns:
- time in seconds corresponding to this DateWritable
timeToDate
public static Date timeToDate(long l)
daysToMillis
public static long daysToMillis(int d)
dateToDays
public static int dateToDays(Date d)
setFromBytes
public void setFromBytes(byte[] bytes,
int offset,
int length,
LazyBinaryUtils.VInt vInt)
writeToByteStream
public void writeToByteStream(ByteStream.Output byteStream)
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
write
public void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
compareTo
public int compareTo(DateWritable d)
- Specified by:
compareTo
in interface Comparable<DateWritable>
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
Copyright © 2014 The Apache Software Foundation. All rights reserved.