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

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.objectinspector.StandardListObjectInspector
All Implemented Interfaces:
Cloneable, ListObjectInspector, ObjectInspector, SettableListObjectInspector
Direct Known Subclasses:
LazyBinaryListObjectInspector, StandardConstantListObjectInspector

public class StandardListObjectInspector
extends Object
implements SettableListObjectInspector

DefaultListObjectInspector works on list data that is stored as a Java List or Java Array object. Always use the ObjectInspectorFactory to create new ObjectInspector objects, instead of directly creating an instance of this class.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector
ObjectInspector.Category
 
Constructor Summary
protected StandardListObjectInspector(ObjectInspector listElementObjectInspector)
          Call ObjectInspectorFactory.getStandardListObjectInspector instead.
 
Method Summary
 Object create(int size)
          Create a list with the given size.
 ObjectInspector.Category getCategory()
          An ObjectInspector must inherit from one of the following interfaces if getCategory() returns: PRIMITIVE: PrimitiveObjectInspector LIST: ListObjectInspector MAP: MapObjectInspector STRUCT: StructObjectInspector.
 List<?> getList(Object data)
          returns null for data = null.
 Object getListElement(Object data, int index)
          returns null for null list, out-of-the-range index.
 ObjectInspector getListElementObjectInspector()
           
 int getListLength(Object data)
          returns -1 for data = null.
 String getTypeName()
          Returns the name of the data type that is inspected by this ObjectInspector.
 Object resize(Object list, int newSize)
          Resize the list.
 Object set(Object list, int index, Object element)
          Set the element at index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardListObjectInspector

protected StandardListObjectInspector(ObjectInspector listElementObjectInspector)
Call ObjectInspectorFactory.getStandardListObjectInspector instead.

Method Detail

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.

Specified by:
getCategory in interface ObjectInspector

getListElementObjectInspector

public ObjectInspector getListElementObjectInspector()
Specified by:
getListElementObjectInspector in interface ListObjectInspector

getListElement

public Object getListElement(Object data,
                             int index)
Description copied from interface: ListObjectInspector
returns null for null list, out-of-the-range index.

Specified by:
getListElement in interface ListObjectInspector

getListLength

public int getListLength(Object data)
Description copied from interface: ListObjectInspector
returns -1 for data = null.

Specified by:
getListLength in interface ListObjectInspector

getList

public List<?> getList(Object data)
Description copied from interface: ListObjectInspector
returns null for data = null. Note: This method should not return a List object that is reused by the same ListObjectInspector, because it's possible that the same ListObjectInspector will be used in multiple places in the code. However it's OK if the List object is part of the Object data.

Specified by:
getList in interface ListObjectInspector

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.

Specified by:
getTypeName in interface ObjectInspector

create

public Object create(int size)
Description copied from interface: SettableListObjectInspector
Create a list with the given size. All elements will be null. NOTE: This is different from ArrayList constructor where the argument is capacity. We decided to have size here to allow creation of Java array.

Specified by:
create in interface SettableListObjectInspector

resize

public Object resize(Object list,
                     int newSize)
Description copied from interface: SettableListObjectInspector
Resize the list. Returns the list. If the new size is bigger than the current size, new elements will be null. If the new size is smaller than the current size, elements at the end are truncated.

Specified by:
resize in interface SettableListObjectInspector

set

public Object set(Object list,
                  int index,
                  Object element)
Description copied from interface: SettableListObjectInspector
Set the element at index. Returns the list.

Specified by:
set in interface SettableListObjectInspector


Copyright © 2012 The Apache Software Foundation