|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hive.serde2.io.TimestampWritable
public class TimestampWritable
TimestampWritable Writable equivalent of java.sq.Timestamp Timestamps are of the format YYYY-MM-DD HH:MM:SS.[fff...] We encode Unix timestamp in seconds in 4 bytes, using the MSB to signify whether the timestamp has a fractional portion. The fractional portion is reversed, and encoded as a VInt so timestamps with less precision use fewer bytes. 0.1 -> 1 0.01 -> 10 0.001 -> 100
Field Summary | |
---|---|
static byte[] |
nullBytes
|
Constructor Summary | |
---|---|
TimestampWritable()
|
|
TimestampWritable(byte[] bytes,
int offset)
|
|
TimestampWritable(Timestamp t)
|
|
TimestampWritable(TimestampWritable t)
|
Method Summary | |
---|---|
int |
compareTo(TimestampWritable t)
|
static void |
convertTimestampToBytes(Timestamp t,
byte[] b,
int offset)
Writes a Timestamp's serialized value to byte array b at |
static Timestamp |
createTimestamp(byte[] bytes,
int offset)
|
static Timestamp |
doubleToTimestamp(double f)
|
boolean |
equals(Object o)
|
static Timestamp |
floatToTimestamp(float f)
Interprets a float as a unix timestamp and returns a Timestamp object |
byte[] |
getBinarySortable()
|
byte[] |
getBytes()
Used to create copies of objects |
double |
getDouble()
|
int |
getNanos()
|
static int |
getNanos(byte[] bytes,
int offset)
|
int |
getSeconds()
|
static int |
getSeconds(byte[] bytes,
int offset)
Gets seconds stored as integer at bytes[offset] |
Timestamp |
getTimestamp()
|
boolean |
hasDecimal()
|
static boolean |
hasDecimal(byte b)
|
int |
hashCode()
|
void |
readFields(DataInput in)
|
void |
set(byte[] bytes,
int offset)
|
void |
set(Timestamp t)
|
void |
set(TimestampWritable t)
|
void |
setBinarySortable(byte[] bytes,
int offset)
Given a byte[] that has binary sortable data, initialize the internal structures to hold that data |
static void |
setTimestamp(Timestamp t,
byte[] bytes,
int offset)
|
String |
toString()
|
void |
write(DataOutput out)
|
void |
write(OutputStream out)
|
void |
writeToByteStream(ByteStream.Output byteStream)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte[] nullBytes
Constructor Detail |
---|
public TimestampWritable()
public TimestampWritable(byte[] bytes, int offset)
public TimestampWritable(TimestampWritable t)
public TimestampWritable(Timestamp t)
Method Detail |
---|
public void set(byte[] bytes, int offset)
public void set(Timestamp t)
public void set(TimestampWritable t)
public void writeToByteStream(ByteStream.Output byteStream)
public int getSeconds()
public int getNanos()
public Timestamp getTimestamp()
public byte[] getBytes()
public byte[] getBinarySortable()
public void setBinarySortable(byte[] bytes, int offset)
bytes
- offset
- public double getDouble()
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(OutputStream out) throws IOException
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public int compareTo(TimestampWritable t)
compareTo
in interface Comparable<TimestampWritable>
public boolean equals(Object o)
equals
in class Object
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public static int getSeconds(byte[] bytes, int offset)
bytes
- offset
-
public static int getNanos(byte[] bytes, int offset)
public static void convertTimestampToBytes(Timestamp t, byte[] b, int offset)
t
- b
- public static Timestamp floatToTimestamp(float f)
f
-
public static Timestamp doubleToTimestamp(double f)
public static void setTimestamp(Timestamp t, byte[] bytes, int offset)
public static Timestamp createTimestamp(byte[] bytes, int offset)
public boolean hasDecimal()
public static boolean hasDecimal(byte b)
b
- first byte in an encoded TimestampWritable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |