org.apache.hadoop.hive.serde2.columnar
Class ColumnarStruct

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.columnar.ColumnarStruct

public class ColumnarStruct
extends Object

ColumnarStruct is different from LazyStruct in that ColumnarStruct's field Object get parsed at its initialize time when call init(BytesRefArrayWritable cols), while LazyStruct parse fields in a lazy way.


Constructor Summary
ColumnarStruct(ObjectInspector oi)
          Construct a ColumnarStruct object with the TypeInfo.
ColumnarStruct(ObjectInspector oi, ArrayList<Integer> notSkippedColumnIDs)
          Construct a ColumnarStruct object with the TypeInfo.
 
Method Summary
 Object getField(int fieldID, org.apache.hadoop.io.Text nullSequence)
          Get one field out of the struct.
 ArrayList<Object> getFieldsAsList(org.apache.hadoop.io.Text nullSequence)
          Get the values of the fields as an ArrayList.
 void init(BytesRefArrayWritable cols)
           
protected  Object uncheckedGetField(int fieldID, org.apache.hadoop.io.Text nullSequence)
          Get the field out of the row without checking parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnarStruct

public ColumnarStruct(ObjectInspector oi)
Construct a ColumnarStruct object with the TypeInfo. It creates the first level object at the first place

Parameters:
oi - the ObjectInspector representing the type of this LazyStruct.

ColumnarStruct

public ColumnarStruct(ObjectInspector oi,
                      ArrayList<Integer> notSkippedColumnIDs)
Construct a ColumnarStruct object with the TypeInfo. It creates the first level object at the first place

Parameters:
oi - the ObjectInspector representing the type of this LazyStruct.
notSkippedColumnIDs - the column ids that should not be skipped
Method Detail

getField

public Object getField(int fieldID,
                       org.apache.hadoop.io.Text nullSequence)
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). NOTE: separator and nullSequence has to be the same each time this method is called. These two parameters are used only once to parse each record.

Parameters:
fieldID - The field ID
nullSequence - The sequence for null value
Returns:
The field as a LazyObject

uncheckedGetField

protected Object uncheckedGetField(int fieldID,
                                   org.apache.hadoop.io.Text nullSequence)
Get the field out of the row without checking parsed. This is called by both getField and getFieldsAsList.

Parameters:
fieldID - The id of the field starting from 0.
nullSequence - The sequence representing NULL value.
Returns:
The value of the field

init

public void init(BytesRefArrayWritable cols)

getFieldsAsList

public ArrayList<Object> getFieldsAsList(org.apache.hadoop.io.Text nullSequence)
Get the values of the fields as an ArrayList.

Parameters:
nullSequence - The sequence for the NULL value
Returns:
The values of the fields as an ArrayList.


Copyright © 2010 The Apache Software Foundation