|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.facebook.thrift.protocol.TProtocol
org.apache.hadoop.hive.serde2.thrift.TBinarySortableProtocol
public class TBinarySortableProtocol
An implementation of the Thrift Protocol for binary sortable records. The data format: NULL: a single byte \0 NON-NULL Primitives: ALWAYS prepend a single byte \1, and then: Boolean: FALSE = \1, TRUE = \2 Byte: flip the sign-bit to make sure negative comes before positive Short: flip the sign-bit to make sure negative comes before positive Int: flip the sign-bit to make sure negative comes before positive Long: flip the sign-bit to make sure negative comes before positive Double: flip the sign-bit for positive double, and all bits for negative double values String: NULL-terminated UTF-8 string, with NULL escaped to \1 \1, and \1 escaped to \1 \2 NON-NULL Complex Types: Struct: first the single byte \1, and then one field by one field. List: size stored as Int (see above), then one element by one element. Map: size stored as Int (see above), then one key by one value, and then the next pair and so on. Binary: size stored as Int (see above), then the binary data in its original form Note that the relative order of list/map/binary will be based on the size first (and elements one by one if the sizes are equal). This protocol takes an additional parameter SERIALIZATION_SORT_ORDER which is a string containing only "+" and "-". The length of the string should equal to the number of fields in the top-level struct for serialization. "+" means the field should be sorted ascendingly, and "-" means descendingly. The sub fields in the same top-level field will have the same sort order. This is not thrift compliant in that it doesn't write out field ids so things cannot actually be versioned.
Nested Class Summary | |
---|---|
static class |
TBinarySortableProtocol.Factory
Factory for TBinarySortableProtocol objects |
Field Summary | |
---|---|
protected byte[] |
escapedNull
The escaped byte sequence for the null byte. |
protected byte[] |
escapedOne
The escaped byte sequence for the "\1" byte. |
protected byte[] |
nonNullByte
|
protected byte[] |
nullByte
|
Fields inherited from class com.facebook.thrift.protocol.TProtocol |
---|
trans_ |
Constructor Summary | |
---|---|
TBinarySortableProtocol(com.facebook.thrift.transport.TTransport trans)
|
Method Summary | |
---|---|
void |
initialize(org.apache.hadoop.conf.Configuration conf,
Properties tbl)
Initialize the TProtocol |
boolean |
lastPrimitiveWasNull()
Was the last primitive read really a NULL. |
byte[] |
readBinary()
|
boolean |
readBool()
|
byte |
readByte()
|
double |
readDouble()
|
com.facebook.thrift.protocol.TField |
readFieldBegin()
|
void |
readFieldEnd()
|
short |
readI16()
|
int |
readI32()
|
long |
readI64()
|
boolean |
readIsNull()
|
com.facebook.thrift.protocol.TList |
readListBegin()
This method always return the same instance of TList to avoid creating new instances. |
void |
readListEnd()
|
com.facebook.thrift.protocol.TMap |
readMapBegin()
This method always return the same instance of TMap to avoid creating new instances. |
void |
readMapEnd()
|
com.facebook.thrift.protocol.TMessage |
readMessageBegin()
|
void |
readMessageEnd()
|
com.facebook.thrift.protocol.TSet |
readSetBegin()
This method always return the same instance of TSet to avoid creating new instances. |
void |
readSetEnd()
|
String |
readString()
|
com.facebook.thrift.protocol.TStruct |
readStructBegin()
|
void |
readStructEnd()
|
void |
writeBinary(byte[] bin)
|
void |
writeBool(boolean b)
|
void |
writeByte(byte b)
|
void |
writeDouble(double dub)
|
void |
writeFieldBegin(com.facebook.thrift.protocol.TField field)
|
void |
writeFieldEnd()
|
void |
writeFieldStop()
|
void |
writeI16(short i16)
|
void |
writeI32(int i32)
|
void |
writeI64(long i64)
|
void |
writeListBegin(com.facebook.thrift.protocol.TList list)
|
void |
writeListEnd()
|
void |
writeMapBegin(com.facebook.thrift.protocol.TMap map)
|
void |
writeMapEnd()
|
void |
writeMessageBegin(com.facebook.thrift.protocol.TMessage message)
|
void |
writeMessageEnd()
|
void |
writeNull()
Write a null |
void |
writeSetBegin(com.facebook.thrift.protocol.TSet set)
|
void |
writeSetEnd()
|
void |
writeString(String str)
|
void |
writeStructBegin(com.facebook.thrift.protocol.TStruct struct)
|
void |
writeStructEnd()
|
Methods inherited from class com.facebook.thrift.protocol.TProtocol |
---|
getTransport |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final byte[] nullByte
protected final byte[] nonNullByte
protected final byte[] escapedNull
protected final byte[] escapedOne
Constructor Detail |
---|
public TBinarySortableProtocol(com.facebook.thrift.transport.TTransport trans)
Method Detail |
---|
public void initialize(org.apache.hadoop.conf.Configuration conf, Properties tbl) throws com.facebook.thrift.TException
ConfigurableTProtocol
initialize
in interface ConfigurableTProtocol
conf
- System propertiestbl
- table properties
com.facebook.thrift.TException
public void writeMessageBegin(com.facebook.thrift.protocol.TMessage message) throws com.facebook.thrift.TException
writeMessageBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeMessageEnd() throws com.facebook.thrift.TException
writeMessageEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeStructBegin(com.facebook.thrift.protocol.TStruct struct) throws com.facebook.thrift.TException
writeStructBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeStructEnd() throws com.facebook.thrift.TException
writeStructEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeFieldBegin(com.facebook.thrift.protocol.TField field) throws com.facebook.thrift.TException
writeFieldBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeFieldEnd() throws com.facebook.thrift.TException
writeFieldEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeFieldStop()
writeFieldStop
in class com.facebook.thrift.protocol.TProtocol
public void writeMapBegin(com.facebook.thrift.protocol.TMap map) throws com.facebook.thrift.TException
writeMapBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeMapEnd() throws com.facebook.thrift.TException
writeMapEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeListBegin(com.facebook.thrift.protocol.TList list) throws com.facebook.thrift.TException
writeListBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeListEnd() throws com.facebook.thrift.TException
writeListEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeSetBegin(com.facebook.thrift.protocol.TSet set) throws com.facebook.thrift.TException
writeSetBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeSetEnd() throws com.facebook.thrift.TException
writeSetEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeBool(boolean b) throws com.facebook.thrift.TException
writeBool
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeByte(byte b) throws com.facebook.thrift.TException
writeByte
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeI16(short i16) throws com.facebook.thrift.TException
writeI16
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeI32(int i32) throws com.facebook.thrift.TException
writeI32
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeI64(long i64) throws com.facebook.thrift.TException
writeI64
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeDouble(double dub) throws com.facebook.thrift.TException
writeDouble
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeString(String str) throws com.facebook.thrift.TException
writeString
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void writeBinary(byte[] bin) throws com.facebook.thrift.TException
writeBinary
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public com.facebook.thrift.protocol.TMessage readMessageBegin() throws com.facebook.thrift.TException
readMessageBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void readMessageEnd() throws com.facebook.thrift.TException
readMessageEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public com.facebook.thrift.protocol.TStruct readStructBegin() throws com.facebook.thrift.TException
readStructBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void readStructEnd() throws com.facebook.thrift.TException
readStructEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public com.facebook.thrift.protocol.TField readFieldBegin() throws com.facebook.thrift.TException
readFieldBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void readFieldEnd() throws com.facebook.thrift.TException
readFieldEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public com.facebook.thrift.protocol.TMap readMapBegin() throws com.facebook.thrift.TException
readMapBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void readMapEnd() throws com.facebook.thrift.TException
readMapEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public com.facebook.thrift.protocol.TList readListBegin() throws com.facebook.thrift.TException
readListBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void readListEnd() throws com.facebook.thrift.TException
readListEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public com.facebook.thrift.protocol.TSet readSetBegin() throws com.facebook.thrift.TException
readSetBegin
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public void readSetEnd() throws com.facebook.thrift.TException
readSetEnd
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public boolean readBool() throws com.facebook.thrift.TException
readBool
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public final boolean readIsNull() throws com.facebook.thrift.TException
com.facebook.thrift.TException
public byte readByte() throws com.facebook.thrift.TException
readByte
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public short readI16() throws com.facebook.thrift.TException
readI16
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public int readI32() throws com.facebook.thrift.TException
readI32
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public long readI64() throws com.facebook.thrift.TException
readI64
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public double readDouble() throws com.facebook.thrift.TException
readDouble
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public String readString() throws com.facebook.thrift.TException
readString
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public byte[] readBinary() throws com.facebook.thrift.TException
readBinary
in class com.facebook.thrift.protocol.TProtocol
com.facebook.thrift.TException
public boolean lastPrimitiveWasNull() throws com.facebook.thrift.TException
WriteNullsProtocol
lastPrimitiveWasNull
in interface WriteNullsProtocol
com.facebook.thrift.TException
public void writeNull() throws com.facebook.thrift.TException
WriteNullsProtocol
writeNull
in interface WriteNullsProtocol
com.facebook.thrift.TException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |