org.apache.hadoop.hive.serde2.lazy
Class LazyStruct

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.lazy.LazyObjectBase
      extended by org.apache.hadoop.hive.serde2.lazy.LazyObject<OI>
          extended by org.apache.hadoop.hive.serde2.lazy.LazyNonPrimitive<LazySimpleStructObjectInspector>
              extended by org.apache.hadoop.hive.serde2.lazy.LazyStruct
All Implemented Interfaces:
SerDeStatsStruct

public class LazyStruct
extends LazyNonPrimitive<LazySimpleStructObjectInspector>
implements SerDeStatsStruct

LazyObject for storing a struct. The field of a struct can be primitive or non-primitive. LazyStruct does not deal with the case of a NULL struct. That is handled by the parent LazyObject.


Field Summary
 
Fields inherited from class org.apache.hadoop.hive.serde2.lazy.LazyNonPrimitive
bytes, length, start
 
Fields inherited from class org.apache.hadoop.hive.serde2.lazy.LazyObject
oi
 
Constructor Summary
LazyStruct(LazySimpleStructObjectInspector oi)
          Construct a LazyStruct object with the ObjectInspector.
 
Method Summary
 Object getField(int fieldID)
          Get one field out of the struct.
protected  boolean[] getFieldInited()
           
protected  LazyObject[] getFields()
           
 ArrayList<Object> getFieldsAsList()
          Get the values of the fields as an ArrayList.
 Object getObject()
          If the LazyObjectBase is a primitive Object, then deserialize it and return the actual primitive Object.
protected  boolean getParsed()
           
 long getRawDataSerializedSize()
          Rerurns the serialized size of the object.
 void init(ByteArrayRef bytes, int start, int length)
          Set the row data for this LazyStruct.
protected  void setFieldInited(boolean[] fieldInited)
           
protected  void setFields(LazyObject[] fields)
           
protected  void setParsed(boolean parsed)
           
 
Methods inherited from class org.apache.hadoop.hive.serde2.lazy.LazyNonPrimitive
hashCode
 
Methods inherited from class org.apache.hadoop.hive.serde2.lazy.LazyObject
getInspector, setInspector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyStruct

public LazyStruct(LazySimpleStructObjectInspector oi)
Construct a LazyStruct object with the ObjectInspector.

Method Detail

init

public void init(ByteArrayRef bytes,
                 int start,
                 int length)
Set the row data for this LazyStruct.

Overrides:
init in class LazyNonPrimitive<LazySimpleStructObjectInspector>
Parameters:
bytes - The wrapper of the byte[].
start - The start position inside the bytes.
length - The length of the data, starting from "start"
See Also:
LazyObjectBase.init(ByteArrayRef, int, int)

getField

public Object getField(int fieldID)
Get one field out of the struct. If the field is a primitive field, return the actual object. Otherwise return the LazyObject. This is because PrimitiveObjectInspector does not have control over the object used by the user - the user simply directly use the Object instead of going through Object PrimitiveObjectInspector.get(Object).

Parameters:
fieldID - The field ID
Returns:
The field as a LazyObject

getFieldsAsList

public ArrayList<Object> getFieldsAsList()
Get the values of the fields as an ArrayList.

Returns:
The values of the fields as an ArrayList.

getObject

public Object getObject()
Description copied from class: LazyObjectBase
If the LazyObjectBase is a primitive Object, then deserialize it and return the actual primitive Object. Otherwise (array, map, struct), return this.

Overrides:
getObject in class LazyNonPrimitive<LazySimpleStructObjectInspector>

getParsed

protected boolean getParsed()

setParsed

protected void setParsed(boolean parsed)

getFields

protected LazyObject[] getFields()

setFields

protected void setFields(LazyObject[] fields)

getFieldInited

protected boolean[] getFieldInited()

setFieldInited

protected void setFieldInited(boolean[] fieldInited)

getRawDataSerializedSize

public long getRawDataSerializedSize()
Description copied from interface: SerDeStatsStruct
Rerurns the serialized size of the object.

Specified by:
getRawDataSerializedSize in interface SerDeStatsStruct


Copyright © 2013 The Apache Software Foundation