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

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.objectinspector.StandardMapObjectInspector
All Implemented Interfaces:
MapObjectInspector, ObjectInspector
Direct Known Subclasses:
LazyBinaryMapObjectInspector

public class StandardMapObjectInspector
extends Object
implements MapObjectInspector

StandardMapObjectInspector works on map data that is stored as a Java Map object. Note: the key object of the map must support equals and hashCode by itself. We also plan to have a GeneralMapObjectInspector which can work on map with key objects that does not support equals and hashCode. That will require us to store InspectableObject as the key, which will have overridden equals and hashCode methods. 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 StandardMapObjectInspector(ObjectInspector mapKeyObjectInspector, ObjectInspector mapValueObjectInspector)
          Call ObjectInspectorFactory.getStandardMapObjectInspector instead.
 
Method Summary
 ObjectInspector.Category getCategory()
          An ObjectInspector must inherit from one of the following interfaces if getCategory() returns: PRIMITIVE: PrimitiveObjectInspector LIST: ListObjectInspector MAP: MapObjectInspector STRUCT: StructObjectInspector
 Map<?,?> getMap(Object data)
          returns null for data = null.
 ObjectInspector getMapKeyObjectInspector()
           
 int getMapSize(Object data)
          returns -1 for NULL map.
 Object getMapValueElement(Object data, Object key)
           
 ObjectInspector getMapValueObjectInspector()
           
 String getTypeName()
          Returns the name of the data type that is inspected by this ObjectInspector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardMapObjectInspector

protected StandardMapObjectInspector(ObjectInspector mapKeyObjectInspector,
                                     ObjectInspector mapValueObjectInspector)
Call ObjectInspectorFactory.getStandardMapObjectInspector instead.

Method Detail

getMapKeyObjectInspector

public ObjectInspector getMapKeyObjectInspector()
Specified by:
getMapKeyObjectInspector in interface MapObjectInspector

getMapValueObjectInspector

public ObjectInspector getMapValueObjectInspector()
Specified by:
getMapValueObjectInspector in interface MapObjectInspector

getMapValueElement

public Object getMapValueElement(Object data,
                                 Object key)
Specified by:
getMapValueElement in interface MapObjectInspector

getMapSize

public int getMapSize(Object data)
Description copied from interface: MapObjectInspector
returns -1 for NULL map.

Specified by:
getMapSize in interface MapObjectInspector

getMap

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

Specified by:
getMap in interface MapObjectInspector

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

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


Copyright © 2009 The Apache Software Foundation