org.apache.hadoop.hive.serde2.typeinfo
Class PrimitiveTypeInfo

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.typeinfo.TypeInfo
      extended by org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo
All Implemented Interfaces:
Serializable, PrimitiveTypeSpec

public class PrimitiveTypeInfo
extends TypeInfo
implements Serializable, PrimitiveTypeSpec

There are limited number of Primitive Types. All Primitive Types are defined by TypeInfoFactory.isPrimitiveClass(). Always use the TypeInfoFactory to create new TypeInfo objects, instead of directly creating an instance of this class.

See Also:
Serialized Form

Field Summary
protected  String typeName
           
protected  BaseTypeParams typeParams
           
 
Constructor Summary
PrimitiveTypeInfo()
          For java serialization use only.
 
Method Summary
 boolean equals(Object other)
          Compare if 2 TypeInfos are the same.
 ObjectInspector.Category getCategory()
          Returns the category of this TypeInfo.
 PrimitiveObjectInspector.PrimitiveCategory getPrimitiveCategory()
           
 Class<?> getPrimitiveJavaClass()
           
 PrimitiveObjectInspectorUtils.PrimitiveTypeEntry getPrimitiveTypeEntry()
           
 Class<?> getPrimitiveWritableClass()
           
 String getTypeName()
          A String representation of the TypeInfo.
 BaseTypeParams getTypeParams()
          If the type has type parameters (such as varchar length, or decimal precision/scale), then return the parameters for the type.
 int hashCode()
          Generate the hashCode for this TypeInfo.
 void setTypeName(String typeName)
           
 void setTypeParams(BaseTypeParams typeParams)
          Set the type parameters for the type.
 String toString()
           
 
Methods inherited from class org.apache.hadoop.hive.serde2.typeinfo.TypeInfo
getQualifiedName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

typeName

protected String typeName

typeParams

protected BaseTypeParams typeParams
Constructor Detail

PrimitiveTypeInfo

public PrimitiveTypeInfo()
For java serialization use only.

Method Detail

getCategory

public ObjectInspector.Category getCategory()
Returns the category of this TypeInfo.

Specified by:
getCategory in class TypeInfo

getPrimitiveCategory

public PrimitiveObjectInspector.PrimitiveCategory getPrimitiveCategory()
Specified by:
getPrimitiveCategory in interface PrimitiveTypeSpec
Returns:
PrimitiveCategory referred to by the PrimitiveTypeSpec

getPrimitiveWritableClass

public Class<?> getPrimitiveWritableClass()

getPrimitiveJavaClass

public Class<?> getPrimitiveJavaClass()

setTypeName

public void setTypeName(String typeName)

getTypeName

public String getTypeName()
Description copied from class: TypeInfo
A String representation of the TypeInfo.

Specified by:
getTypeName in class TypeInfo

getTypeParams

public BaseTypeParams getTypeParams()
If the type has type parameters (such as varchar length, or decimal precision/scale), then return the parameters for the type.

Specified by:
getTypeParams in interface PrimitiveTypeSpec
Returns:
A BaseTypeParams object representing the parameters for the type, or null

setTypeParams

public void setTypeParams(BaseTypeParams typeParams)
Set the type parameters for the type.

Parameters:
typeParams - type parameters for the type

getPrimitiveTypeEntry

public PrimitiveObjectInspectorUtils.PrimitiveTypeEntry getPrimitiveTypeEntry()

equals

public boolean equals(Object other)
Compare if 2 TypeInfos are the same. We use TypeInfoFactory to cache TypeInfos, so we only need to compare the Object pointer.

Specified by:
equals in class TypeInfo

hashCode

public int hashCode()
Generate the hashCode for this TypeInfo.

Specified by:
hashCode in class TypeInfo

toString

public String toString()
Overrides:
toString in class TypeInfo


Copyright © 2012 The Apache Software Foundation