org.apache.hadoop.hive.serde2.objectinspector
Class StandardStructObjectInspector

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector
      extended by org.apache.hadoop.hive.serde2.objectinspector.SettableStructObjectInspector
          extended by org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector
All Implemented Interfaces:
Cloneable, ObjectInspector
Direct Known Subclasses:
LazyBinaryStructObjectInspector, MetadataListStructObjectInspector

public class StandardStructObjectInspector
extends SettableStructObjectInspector

ListStructObjectInspector works on struct data that is stored as a Java List or Java Array object. Basically, the fields are stored sequentially in the List object. The names of the struct fields and the internal structure of the struct fields are specified in the ctor of the StructObjectInspector. Always use the ObjectInspectorFactory to create new ObjectInspector objects, instead of directly creating an instance of this class.


Nested Class Summary
protected static class StandardStructObjectInspector.MyField
           
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector
ObjectInspector.Category
 
Field Summary
protected  List<StandardStructObjectInspector.MyField> fields
           
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
protected StandardStructObjectInspector(List<String> structFieldNames, List<ObjectInspector> structFieldObjectInspectors)
          Call ObjectInspectorFactory.getStandardListObjectInspector instead.
protected StandardStructObjectInspector(List<StructField> fields)
           
 
Method Summary
 Object create()
          Create a struct which is not null, but all its fields are null.
 List<? extends StructField> getAllStructFieldRefs()
          Returns all the fields.
 ObjectInspector.Category getCategory()
          An ObjectInspector must inherit from one of the following interfaces if getCategory() returns: PRIMITIVE: PrimitiveObjectInspector LIST: ListObjectInspector MAP: MapObjectInspector STRUCT: StructObjectInspector.
 Object getStructFieldData(Object data, StructField fieldRef)
          returns null for data = null.
 StructField getStructFieldRef(String fieldName)
          Look up a field.
 List<Object> getStructFieldsDataAsList(Object data)
          returns null for data = null.
 String getTypeName()
          Returns the name of the data type that is inspected by this ObjectInspector.
protected  void init(List<String> structFieldNames, List<ObjectInspector> structFieldObjectInspectors)
           
protected  void init(List<StructField> fields)
           
 Object setStructFieldData(Object struct, StructField field, Object fieldValue)
          Modify the value of a field.
 
Methods inherited from class org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

fields

protected List<StandardStructObjectInspector.MyField> fields
Constructor Detail

StandardStructObjectInspector

protected StandardStructObjectInspector(List<String> structFieldNames,
                                        List<ObjectInspector> structFieldObjectInspectors)
Call ObjectInspectorFactory.getStandardListObjectInspector instead.


StandardStructObjectInspector

protected StandardStructObjectInspector(List<StructField> fields)
Method Detail

getTypeName

public String getTypeName()
Description copied from interface: ObjectInspector
Returns the name of the data type that is inspected by this ObjectInspector. This is used to display the type information to the user. For primitive types, the type name is standardized. For other types, the type name can be something like "list", "map", java class names, or user-defined type names similar to typedef.


init

protected void init(List<String> structFieldNames,
                    List<ObjectInspector> structFieldObjectInspectors)

init

protected void init(List<StructField> fields)

getCategory

public final ObjectInspector.Category getCategory()
Description copied from interface: ObjectInspector
An ObjectInspector must inherit from one of the following interfaces if getCategory() returns: PRIMITIVE: PrimitiveObjectInspector LIST: ListObjectInspector MAP: MapObjectInspector STRUCT: StructObjectInspector.


getStructFieldRef

public StructField getStructFieldRef(String fieldName)
Description copied from class: StructObjectInspector
Look up a field.

Specified by:
getStructFieldRef in class StructObjectInspector

getAllStructFieldRefs

public List<? extends StructField> getAllStructFieldRefs()
Description copied from class: StructObjectInspector
Returns all the fields.

Specified by:
getAllStructFieldRefs in class StructObjectInspector

getStructFieldData

public Object getStructFieldData(Object data,
                                 StructField fieldRef)
Description copied from class: StructObjectInspector
returns null for data = null.

Specified by:
getStructFieldData in class StructObjectInspector

getStructFieldsDataAsList

public List<Object> getStructFieldsDataAsList(Object data)
Description copied from class: StructObjectInspector
returns null for data = null.

Specified by:
getStructFieldsDataAsList in class StructObjectInspector

create

public Object create()
Description copied from class: SettableStructObjectInspector
Create a struct which is not null, but all its fields are null.

Specified by:
create in class SettableStructObjectInspector

setStructFieldData

public Object setStructFieldData(Object struct,
                                 StructField field,
                                 Object fieldValue)
Description copied from class: SettableStructObjectInspector
Modify the value of a field. Returns the struct.

Specified by:
setStructFieldData in class SettableStructObjectInspector


Copyright © 2010 The Apache Software Foundation