public class TimestampWritable extends Object implements org.apache.hadoop.io.WritableComparable<TimestampWritable>
Modifier and Type | Field and Description |
---|---|
static int |
BINARY_SORTABLE_LENGTH |
static int |
MAX_BYTES
The maximum number of bytes required for a TimestampWritable
|
static byte[] |
nullBytes |
Constructor and Description |
---|
TimestampWritable() |
TimestampWritable(byte[] bytes,
int offset) |
TimestampWritable(Timestamp t) |
TimestampWritable(TimestampWritable t) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(TimestampWritable t) |
static void |
convertTimestampToBytes(Timestamp t,
byte[] b,
int offset)
Writes a Timestamp's serialized value to byte array b at the given offset
|
static Timestamp |
createTimestamp(byte[] bytes,
int offset) |
static Timestamp |
decimalToTimestamp(HiveDecimal d) |
static Timestamp |
doubleToTimestamp(double f) |
boolean |
equals(Object o) |
byte[] |
getBinarySortable() |
byte[] |
getBytes()
Used to create copies of objects
|
double |
getDouble() |
int |
getNanos() |
static int |
getNanos(byte[] bytes,
int offset) |
long |
getSeconds() |
static long |
getSeconds(byte[] bytes,
int offset)
Gets seconds stored as integer at bytes[offset]
|
Timestamp |
getTimestamp() |
static int |
getTotalLength(byte[] bytes,
int offset) |
boolean |
hasDecimal() |
int |
hashCode() |
static Timestamp |
longToTimestamp(long time,
boolean intToTimestampInSeconds)
Converts the time in seconds or milliseconds to a timestamp.
|
void |
readFields(DataInput in) |
void |
set(byte[] bytes,
int offset) |
void |
set(Timestamp t) |
void |
set(TimestampWritable t) |
void |
setBinarySortable(byte[] bytes,
int binSortOffset)
Given a byte[] that has binary sortable data, initialize the internal
structures to hold that data
|
void |
setTime(long time) |
static void |
setTimestamp(Timestamp t,
byte[] bytes,
int offset) |
String |
toString() |
void |
write(DataOutput out) |
void |
write(OutputStream out) |
void |
writeToByteStream(ByteStream.RandomAccessOutput byteStream) |
public static final byte[] nullBytes
public static final int MAX_BYTES
public static final int BINARY_SORTABLE_LENGTH
public TimestampWritable()
public TimestampWritable(byte[] bytes, int offset)
public TimestampWritable(TimestampWritable t)
public TimestampWritable(Timestamp t)
public void set(byte[] bytes, int offset)
public void setTime(long time)
public void set(Timestamp t)
public void set(TimestampWritable t)
public void writeToByteStream(ByteStream.RandomAccessOutput byteStream)
public long getSeconds()
public int getNanos()
public static int getTotalLength(byte[] bytes, int offset)
public Timestamp getTimestamp()
public byte[] getBytes()
public byte[] getBinarySortable()
public void setBinarySortable(byte[] bytes, int binSortOffset)
bytes
- the byte array that holds the binary sortable representationbinSortOffset
- offset of the binary-sortable representation within the buffer.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 static long 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
- to convert to bytesb
- destination byte arrayoffset
- destination offset in the byte arraypublic static Timestamp decimalToTimestamp(HiveDecimal d)
public static Timestamp longToTimestamp(long time, boolean intToTimestampInSeconds)
time
- time in seconds or in millisecondspublic static Timestamp doubleToTimestamp(double f)
public static void setTimestamp(Timestamp t, byte[] bytes, int offset)
public static Timestamp createTimestamp(byte[] bytes, int offset)
public final boolean hasDecimal()
Copyright © 2017 The Apache Software Foundation. All rights reserved.