org.apache.hadoop.hive.serde2.lazybinary
Class LazyBinarySerDe

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
All Implemented Interfaces:
Deserializer, SerDe, Serializer

public class LazyBinarySerDe
extends Object
implements SerDe

The LazyBinarySerDe class combines the lazy property of LazySimpleSerDe class and the binary property of BinarySortable class. Lazy means a field is not deserialized until required. Binary means a field is serialized in binary compact format.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
LazyBinarySerDe()
           
 
Method Summary
 Object deserialize(org.apache.hadoop.io.Writable field)
          Deserialize a table record to a lazybinary struct.
 ObjectInspector getObjectInspector()
          Returns the ObjectInspector for the row.
 SerDeStats getSerDeStats()
          Returns the statistics after (de)serialization)
 Class<? extends org.apache.hadoop.io.Writable> getSerializedClass()
          Returns the Writable Class after serialization.
 void initialize(org.apache.hadoop.conf.Configuration conf, Properties tbl)
          Initialize the SerDe with configuration and table information.
static boolean serialize(ByteStream.Output byteStream, Object obj, ObjectInspector objInspector, boolean skipLengthPrefix, boolean warnedOnceNullMapKey)
          A recursive function that serialize an object to a byte buffer based on its object inspector.
 org.apache.hadoop.io.Writable serialize(Object obj, ObjectInspector objInspector)
          Serialize an object to a byte buffer in a binary compact way.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

LazyBinarySerDe

public LazyBinarySerDe()
                throws SerDeException
Throws:
SerDeException
Method Detail

initialize

public void initialize(org.apache.hadoop.conf.Configuration conf,
                       Properties tbl)
                throws SerDeException
Initialize the SerDe with configuration and table information.

Specified by:
initialize in interface Deserializer
Specified by:
initialize in interface Serializer
Parameters:
conf - System properties
tbl - table properties
Throws:
SerDeException

getObjectInspector

public ObjectInspector getObjectInspector()
                                   throws SerDeException
Returns the ObjectInspector for the row.

Specified by:
getObjectInspector in interface Deserializer
Throws:
SerDeException

getSerializedClass

public Class<? extends org.apache.hadoop.io.Writable> getSerializedClass()
Returns the Writable Class after serialization.

Specified by:
getSerializedClass in interface Serializer

deserialize

public Object deserialize(org.apache.hadoop.io.Writable field)
                   throws SerDeException
Deserialize a table record to a lazybinary struct.

Specified by:
deserialize in interface Deserializer
Parameters:
field - The Writable object containing a serialized object
Returns:
A Java object representing the contents in the blob.
Throws:
SerDeException

serialize

public org.apache.hadoop.io.Writable serialize(Object obj,
                                               ObjectInspector objInspector)
                                        throws SerDeException
Serialize an object to a byte buffer in a binary compact way.

Specified by:
serialize in interface Serializer
Throws:
SerDeException

serialize

public static boolean serialize(ByteStream.Output byteStream,
                                Object obj,
                                ObjectInspector objInspector,
                                boolean skipLengthPrefix,
                                boolean warnedOnceNullMapKey)
A recursive function that serialize an object to a byte buffer based on its object inspector.

Parameters:
byteStream - the byte stream storing the serialization data
obj - the object to serialize
objInspector - the object inspector
skipLengthPrefix - a boolean indicating whether length prefix is needed for list/map/struct
warnedOnceNullMapKey - a boolean indicating whether a warning has been issued once already when encountering null map keys
Returns:
a boolean indicating whether a warning for null map keys has been issued once already

getSerDeStats

public SerDeStats getSerDeStats()
Returns the statistics after (de)serialization)

Specified by:
getSerDeStats in interface Deserializer
Specified by:
getSerDeStats in interface Serializer


Copyright © 2013 The Apache Software Foundation