org.apache.hcatalog.data
Class JsonSerDe

Object
  extended by JsonSerDe
All Implemented Interfaces:
Deserializer, SerDe, Serializer

public class JsonSerDe
extends Object
implements SerDe


Constructor Summary
JsonSerDe()
           
 
Method Summary
 Object deserialize(Writable blob)
          Takes JSON string in Text form, and has to return an object representation above it that's readable by the corresponding object inspector.
 String getHiveInternalColumnName(int fpos)
           
 ObjectInspector getObjectInspector()
          Returns an object inspector for the specified schema that is capable of reading in the object representation of the JSON string
 int getPositionFromHiveInternalColumnName(String internalName)
           
 SerDeStats getSerDeStats()
           
 Class<? extends Writable> getSerializedClass()
           
 void initialize(Configuration conf, Properties tbl)
           
 Writable serialize(Object obj, ObjectInspector objInspector)
          Given an object and object inspector pair, traverse the object and generate a Text representation of the object.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonSerDe

public JsonSerDe()
Method Detail

initialize

public void initialize(Configuration conf,
                       Properties tbl)
                throws SerDeException
Specified by:
initialize in interface Deserializer
Specified by:
initialize in interface Serializer
Throws:
SerDeException

deserialize

public Object deserialize(Writable blob)
                   throws SerDeException
Takes JSON string in Text form, and has to return an object representation above it that's readable by the corresponding object inspector. For this implementation, since we're using the jackson parser, we can construct our own object implementation, and we use HCatRecord for it

Specified by:
deserialize in interface Deserializer
Throws:
SerDeException

getHiveInternalColumnName

public String getHiveInternalColumnName(int fpos)

getPositionFromHiveInternalColumnName

public int getPositionFromHiveInternalColumnName(String internalName)

serialize

public Writable serialize(Object obj,
                          ObjectInspector objInspector)
                   throws SerDeException
Given an object and object inspector pair, traverse the object and generate a Text representation of the object.

Specified by:
serialize in interface Serializer
Throws:
SerDeException

getObjectInspector

public ObjectInspector getObjectInspector()
                                   throws SerDeException
Returns an object inspector for the specified schema that is capable of reading in the object representation of the JSON string

Specified by:
getObjectInspector in interface Deserializer
Throws:
SerDeException

getSerializedClass

public Class<? extends Writable> getSerializedClass()
Specified by:
getSerializedClass in interface Serializer

getSerDeStats

public SerDeStats getSerDeStats()
Specified by:
getSerDeStats in interface Deserializer
Specified by:
getSerDeStats in interface Serializer