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

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils

public final class TypeInfoUtils
extends Object

TypeInfoUtils.


Nested Class Summary
static class TypeInfoUtils.PrimitiveParts
           
 
Method Summary
static boolean doPrimitiveCategoriesMatch(TypeInfo ti1, TypeInfo ti2)
          returns true if both TypeInfos are of primitive type, and the primitive category matches.
static Type getArrayElementType(Type t)
          Returns the array element type, if the Type is an array (Object[]), or GenericArrayType (Map[]).
static String getBaseName(String typeName)
           
static int getCharacterLengthForType(PrimitiveTypeInfo typeInfo)
          Return the character length of the type
static List<TypeInfo> getParameterTypeInfos(Method m, int size)
          Get the parameter TypeInfo for a method.
static ObjectInspector getStandardJavaObjectInspectorFromTypeInfo(TypeInfo typeInfo)
          Returns the standard object inspector that can be used to translate an object of that typeInfo to a standard object type.
static ObjectInspector getStandardWritableObjectInspectorFromTypeInfo(TypeInfo typeInfo)
          Returns the standard object inspector that can be used to translate an object of that typeInfo to a standard object type.
static TypeInfo getTypeInfoFromObjectInspector(ObjectInspector oi)
          Get the TypeInfo object from the ObjectInspector object by recursively going into the ObjectInspector structure.
static TypeInfo getTypeInfoFromTypeString(String typeString)
           
static ArrayList<TypeInfo> getTypeInfosFromTypeString(String typeString)
           
static boolean hasParameters(String typeName)
           
static boolean isConversionRequiredForComparison(TypeInfo typeA, TypeInfo typeB)
          Given two types, determine whether conversion needs to occur to compare the two types.
static TypeInfoUtils.PrimitiveParts parsePrimitiveParts(String typeInfoString)
          Make some of the TypeInfo parsing available as a utility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getArrayElementType

public static Type getArrayElementType(Type t)
Returns the array element type, if the Type is an array (Object[]), or GenericArrayType (Map[]). Otherwise return null.


getParameterTypeInfos

public static List<TypeInfo> getParameterTypeInfos(Method m,
                                                   int size)
Get the parameter TypeInfo for a method.

Parameters:
size - In case the last parameter of Method is an array, we will try to return a List with the specified size by repeating the element of the array at the end. In case the size is smaller than the minimum possible number of arguments for the method, null will be returned.

hasParameters

public static boolean hasParameters(String typeName)

getBaseName

public static String getBaseName(String typeName)

doPrimitiveCategoriesMatch

public static boolean doPrimitiveCategoriesMatch(TypeInfo ti1,
                                                 TypeInfo ti2)
returns true if both TypeInfos are of primitive type, and the primitive category matches.

Parameters:
ti1 -
ti2 -
Returns:

parsePrimitiveParts

public static TypeInfoUtils.PrimitiveParts parsePrimitiveParts(String typeInfoString)
Make some of the TypeInfo parsing available as a utility.


getStandardWritableObjectInspectorFromTypeInfo

public static ObjectInspector getStandardWritableObjectInspectorFromTypeInfo(TypeInfo typeInfo)
Returns the standard object inspector that can be used to translate an object of that typeInfo to a standard object type.


getStandardJavaObjectInspectorFromTypeInfo

public static ObjectInspector getStandardJavaObjectInspectorFromTypeInfo(TypeInfo typeInfo)
Returns the standard object inspector that can be used to translate an object of that typeInfo to a standard object type.


getTypeInfoFromObjectInspector

public static TypeInfo getTypeInfoFromObjectInspector(ObjectInspector oi)
Get the TypeInfo object from the ObjectInspector object by recursively going into the ObjectInspector structure.


getTypeInfosFromTypeString

public static ArrayList<TypeInfo> getTypeInfosFromTypeString(String typeString)

getTypeInfoFromTypeString

public static TypeInfo getTypeInfoFromTypeString(String typeString)

isConversionRequiredForComparison

public static boolean isConversionRequiredForComparison(TypeInfo typeA,
                                                        TypeInfo typeB)
Given two types, determine whether conversion needs to occur to compare the two types. This is needed for cases like varchar, where the TypeInfo for varchar(10) != varchar(5), but there would be no need to have to convert to compare these values.

Parameters:
typeA -
typeB -
Returns:

getCharacterLengthForType

public static int getCharacterLengthForType(PrimitiveTypeInfo typeInfo)
Return the character length of the type

Parameters:
typeInfo -
Returns:


Copyright © 2012 The Apache Software Foundation