org.apache.hadoop.hive.serde2
Class AbstractSerDe

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.AbstractSerDe
All Implemented Interfaces:
Deserializer, SerDe, Serializer
Direct Known Subclasses:
AvroSerDe, BinarySortableSerDe, ColumnarSerDeBase, DynamicSerDe, LazyBinarySerDe, LazySimpleSerDe, MetadataTypedColumnsetSerDe, NullStructSerDe, RegexSerDe, TypedSerDe

public abstract class AbstractSerDe
extends Object
implements SerDe

Abstract class for implementing SerDe. The abstract class has been created, so that new methods can be added in the underlying interface, SerDe, and only implementations that need those methods overwrite it.


Constructor Summary
AbstractSerDe()
           
 
Method Summary
abstract  Object deserialize(org.apache.hadoop.io.Writable blob)
          Deserialize an object out of a Writable blob.
abstract  ObjectInspector getObjectInspector()
          Get the object inspector that can be used to navigate through the internal structure of the Object returned from deserialize(...).
abstract  SerDeStats getSerDeStats()
          Returns statistics collected when serializing
abstract  Class<? extends org.apache.hadoop.io.Writable> getSerializedClass()
          Returns the Writable class that would be returned by the serialize method.
abstract  void initialize(org.apache.hadoop.conf.Configuration conf, Properties tbl)
          Initialize the HiveSerializer.
abstract  org.apache.hadoop.io.Writable serialize(Object obj, ObjectInspector objInspector)
          Serialize an object by navigating inside the Object with the ObjectInspector.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSerDe

public AbstractSerDe()
Method Detail

initialize

public abstract void initialize(org.apache.hadoop.conf.Configuration conf,
                                Properties tbl)
                         throws SerDeException
Initialize the HiveSerializer.

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

getSerializedClass

public abstract Class<? extends org.apache.hadoop.io.Writable> getSerializedClass()
Returns the Writable class that would be returned by the serialize method. This is used to initialize SequenceFile header.

Specified by:
getSerializedClass in interface Serializer

serialize

public abstract org.apache.hadoop.io.Writable serialize(Object obj,
                                                        ObjectInspector objInspector)
                                                 throws SerDeException
Serialize an object by navigating inside the Object with the ObjectInspector. In most cases, the return value of this function will be constant since the function will reuse the Writable object. If the client wants to keep a copy of the Writable, the client needs to clone the returned value.

Specified by:
serialize in interface Serializer
Throws:
SerDeException

getSerDeStats

public abstract SerDeStats getSerDeStats()
Returns statistics collected when serializing

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

deserialize

public abstract Object deserialize(org.apache.hadoop.io.Writable blob)
                            throws SerDeException
Deserialize an object out of a Writable blob. In most cases, the return value of this function will be constant since the function will reuse the returned object. If the client wants to keep a copy of the object, the client needs to clone the returned value by calling ObjectInspectorUtils.getStandardObject().

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

getObjectInspector

public abstract ObjectInspector getObjectInspector()
                                            throws SerDeException
Get the object inspector that can be used to navigate through the internal structure of the Object returned from deserialize(...).

Specified by:
getObjectInspector in interface Deserializer
Throws:
SerDeException


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