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

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

public class LazyBinarySerDe
extends AbstractSerDe

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.


Nested Class Summary
static class LazyBinarySerDe.StringWrapper
           
 
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.
static void serializeStruct(ByteStream.Output byteStream, Object[] fieldData, List<ObjectInspector> fieldOis)
           
 
Methods inherited from class java.lang.Object
equals, 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
Specified by:
initialize in class AbstractSerDe
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
Specified by:
getObjectInspector in class AbstractSerDe
Throws:
SerDeException

getSerializedClass

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

Specified by:
getSerializedClass in interface Serializer
Specified by:
getSerializedClass in class AbstractSerDe

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
Specified by:
deserialize in class AbstractSerDe
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
Specified by:
serialize in class AbstractSerDe
Throws:
SerDeException

serializeStruct

public static void serializeStruct(ByteStream.Output byteStream,
                                   Object[] fieldData,
                                   List<ObjectInspector> fieldOis)
                            throws SerDeException
Throws:
SerDeException

serialize

public static boolean serialize(ByteStream.Output byteStream,
                                Object obj,
                                ObjectInspector objInspector,
                                boolean skipLengthPrefix,
                                boolean warnedOnceNullMapKey)
                         throws SerDeException
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
Throws:
SerDeException

getSerDeStats

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

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


Copyright © 2014 The Apache Software Foundation. All rights reserved.