|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lens.lib.query.JSonSerde
public class JSonSerde
This SerDe can be used for processing JSON data in Hive. It supports arbitrary JSON data, and can handle all Hive types except for UNION. However, the JSON data is expected to be a series of discrete records, rather than a JSON array of objects.
The Hive table is expected to contain columns with names corresponding to fields in the JSON data, but it is not necessary for every JSON field to have a corresponding Hive column. Those JSON fields will be ignored during queries. Example: { "a": 1, "b": [ "str1", "str2" ], "c": { "field1": "val1" } } Could correspond to a table: CREATE TABLE foo (a INT, b ARRAY
| Constructor Summary | |
|---|---|
JSonSerde()
|
|
| Method Summary | |
|---|---|
Object |
deserialize(org.apache.hadoop.io.Writable blob)
This method does the work of deserializing a record into Java objects that Hive can work with via the ObjectInspector interface. |
org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector |
getObjectInspector()
Return an ObjectInspector for the row of data |
org.apache.hadoop.hive.serde2.SerDeStats |
getSerDeStats()
Unimplemented |
Class<? extends org.apache.hadoop.io.Writable> |
getSerializedClass()
JSON is just a textual representation, so our serialized class is just Text. |
void |
initialize(org.apache.hadoop.conf.Configuration conf,
Properties tbl)
An initialization function used to gather information about the table. |
org.apache.hadoop.io.Writable |
serialize(Object obj,
org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector oi)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JSonSerde()
| Method Detail |
|---|
public void initialize(org.apache.hadoop.conf.Configuration conf,
Properties tbl)
throws org.apache.hadoop.hive.serde2.SerDeException
initialize in interface org.apache.hadoop.hive.serde2.Deserializerinitialize in interface org.apache.hadoop.hive.serde2.Serializerconf - the conftbl - the tbl
org.apache.hadoop.hive.serde2.SerDeException - the ser de exception
public Object deserialize(org.apache.hadoop.io.Writable blob)
throws org.apache.hadoop.hive.serde2.SerDeException
deserialize in interface org.apache.hadoop.hive.serde2.Deserializerblob - the blob
org.apache.hadoop.hive.serde2.SerDeException - the ser de exception
public org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector getObjectInspector()
throws org.apache.hadoop.hive.serde2.SerDeException
getObjectInspector in interface org.apache.hadoop.hive.serde2.Deserializerorg.apache.hadoop.hive.serde2.SerDeExceptionpublic org.apache.hadoop.hive.serde2.SerDeStats getSerDeStats()
getSerDeStats in interface org.apache.hadoop.hive.serde2.DeserializergetSerDeStats in interface org.apache.hadoop.hive.serde2.Serializerpublic Class<? extends org.apache.hadoop.io.Writable> getSerializedClass()
getSerializedClass in interface org.apache.hadoop.hive.serde2.Serializer
public org.apache.hadoop.io.Writable serialize(Object obj,
org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector oi)
throws org.apache.hadoop.hive.serde2.SerDeException
serialize in interface org.apache.hadoop.hive.serde2.Serializerorg.apache.hadoop.hive.serde2.SerDeException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||