|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hive.serde2.AbstractSerDe
org.apache.hadoop.hive.serde2.binarysortable.BinarySortableSerDe
public class BinarySortableSerDe
BinarySortableSerDe can be used to write data in a way that the data can be compared byte-by-byte with the same order. 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: ALWAYS prepend a single byte \1, and then: Struct: one field by one field. List: \1 followed by each element, and \0 to terminate Map: \1 followed by each key and then each value, and \0 to terminate This SerDe 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.
Field Summary | |
---|---|
static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
BinarySortableSerDe()
|
Method Summary | |
---|---|
Object |
deserialize(Writable blob)
Deserialize an object out of a Writable blob. |
ObjectInspector |
getObjectInspector()
Get the object inspector that can be used to navigate through the internal structure of the Object returned from deserialize(...). |
SerDeStats |
getSerDeStats()
Returns statistics collected when serializing |
Class<? extends Writable> |
getSerializedClass()
Returns the Writable class that would be returned by the serialize method. |
void |
initialize(Configuration conf,
Properties tbl)
Initialize the HiveSerializer. |
Writable |
serialize(Object obj,
ObjectInspector objInspector)
Serialize an object by navigating inside the Object with the ObjectInspector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
public BinarySortableSerDe()
Method Detail |
---|
public void initialize(Configuration conf, Properties tbl) throws SerDeException
AbstractSerDe
initialize
in interface Deserializer
initialize
in interface Serializer
initialize
in class AbstractSerDe
conf
- System propertiestbl
- table properties
SerDeException
public Class<? extends Writable> getSerializedClass()
AbstractSerDe
getSerializedClass
in interface Serializer
getSerializedClass
in class AbstractSerDe
public ObjectInspector getObjectInspector() throws SerDeException
AbstractSerDe
getObjectInspector
in interface Deserializer
getObjectInspector
in class AbstractSerDe
SerDeException
public Object deserialize(Writable blob) throws SerDeException
AbstractSerDe
deserialize
in interface Deserializer
deserialize
in class AbstractSerDe
blob
- The Writable object containing a serialized object
SerDeException
public Writable serialize(Object obj, ObjectInspector objInspector) throws SerDeException
AbstractSerDe
serialize
in interface Serializer
serialize
in class AbstractSerDe
SerDeException
public SerDeStats getSerDeStats()
AbstractSerDe
getSerDeStats
in interface Deserializer
getSerDeStats
in interface Serializer
getSerDeStats
in class AbstractSerDe
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |