|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.hive.ql.exec.FunctionRegistry
public final class FunctionRegistry
FunctionRegistry.
Field Summary | |
---|---|
static String |
LAG_FUNC_NAME
|
static String |
LAST_VALUE_FUNC_NAME
|
static String |
LEAD_FUNC_NAME
|
static String |
NOOP_MAP_TABLE_FUNCTION
|
static String |
NOOP_TABLE_FUNCTION
|
static String |
WINDOWING_TABLE_FUNCTION
|
Method Summary | ||
---|---|---|
static GenericUDF |
cloneGenericUDF(GenericUDF genericUDF)
Create a copy of an existing GenericUDF. |
|
static GenericUDTF |
cloneGenericUDTF(GenericUDTF genericUDTF)
Create a copy of an existing GenericUDTF. |
|
static PrimitiveObjectInspector.PrimitiveCategory |
getCommonCategory(TypeInfo a,
TypeInfo b)
|
|
static TypeInfo |
getCommonClass(TypeInfo a,
TypeInfo b)
Find a common class that objects of both TypeInfo a and TypeInfo b can convert to. |
|
static TypeInfo |
getCommonClassForComparison(TypeInfo a,
TypeInfo b)
Find a common class that objects of both TypeInfo a and TypeInfo b can convert to. |
|
static TypeInfo |
getCommonClassForUnionAll(TypeInfo a,
TypeInfo b)
Find a common class for union-all operator |
|
static FunctionInfo |
getFunctionInfo(String functionName)
|
|
static Set<String> |
getFunctionNames()
Returns a set of registered function names. |
|
static Set<String> |
getFunctionNames(String funcPatternStr)
Returns a set of registered function names. |
|
static Set<String> |
getFunctionSynonyms(String funcName)
Returns the set of synonyms of the supplied function. |
|
static GenericUDAFEvaluator |
getGenericUDAFEvaluator(String name,
List<ObjectInspector> argumentOIs,
boolean isDistinct,
boolean isAllColumns)
Get the GenericUDAF evaluator for the name and argumentClasses. |
|
static GenericUDAFResolver |
getGenericUDAFResolver(String functionName)
|
|
static GenericUDF |
getGenericUDFForAnd()
A shortcut to get the "and" GenericUDF. |
|
static GenericUDF |
getGenericUDFForIndex()
A shortcut to get the "index" GenericUDF. |
|
static GenericUDAFEvaluator |
getGenericWindowingEvaluator(String name,
List<ObjectInspector> argumentOIs,
boolean isDistinct,
boolean isAllColumns)
|
|
static Hive |
getHive()
|
|
static Method |
getMethodInternal(Class<?> udfClass,
List<Method> mlist,
boolean exact,
List<TypeInfo> argumentsPassed)
Gets the closest matching method corresponding to the argument list from a list of methods. |
|
static
|
getMethodInternal(Class<? extends T> udfClass,
String methodName,
boolean exact,
List<TypeInfo> argumentClasses)
This method is shared between UDFRegistry and UDAFRegistry. |
|
static TableFunctionResolver |
getNoopTableFunction()
|
|
static TableFunctionResolver |
getTableFunctionResolver(String name)
|
|
static TypeInfo |
getTypeInfoForPrimitiveCategory(PrimitiveTypeInfo a,
PrimitiveTypeInfo b,
PrimitiveObjectInspector.PrimitiveCategory typeCategory)
Given 2 TypeInfo types and the PrimitiveCategory selected as the common class between the two, return a TypeInfo corresponding to the common PrimitiveCategory, and with type qualifiers (if applicable) that match the 2 TypeInfo types. |
|
static WindowFunctionInfo |
getWindowFunctionInfo(String functionName)
|
|
static TableFunctionResolver |
getWindowingTableFunction()
|
|
static boolean |
implicitConvertable(PrimitiveObjectInspector.PrimitiveCategory from,
PrimitiveObjectInspector.PrimitiveCategory to)
|
|
static boolean |
implicitConvertable(TypeInfo from,
TypeInfo to)
Returns whether it is possible to implicitly convert an object of Class from to Class to. |
|
static boolean |
impliesOrder(String functionName)
Both UDF and UDAF functions can imply order for analytical functions |
|
static Object |
invoke(Method m,
Object thisObject,
Object... arguments)
|
|
static boolean |
isDeterministic(GenericUDF genericUDF)
Returns whether a GenericUDF is deterministic or not. |
|
static boolean |
isExactNumericType(PrimitiveTypeInfo typeInfo)
Check if a type is exact (not approximate such as float and double). |
|
static boolean |
isNativeFuncExpr(ExprNodeGenericFuncDesc fnExpr)
|
|
static boolean |
isNumericType(PrimitiveTypeInfo typeInfo)
Check if the given type is numeric. |
|
static boolean |
isOpAnd(ExprNodeDesc desc)
Returns whether the exprNodeDesc is a node of "and". |
|
static boolean |
isOpAndOrNot(ExprNodeDesc desc)
Returns whether the exprNodeDesc is a node of "and", "or", "not". |
|
static boolean |
isOpNot(ExprNodeDesc desc)
Returns whether the exprNodeDesc is a node of "not". |
|
static boolean |
isOpOr(ExprNodeDesc desc)
Returns whether the exprNodeDesc is a node of "or". |
|
static boolean |
isOpPositive(ExprNodeDesc desc)
Returns whether the exprNodeDesc is a node of "positive". |
|
static boolean |
isOpPreserveInputName(ExprNodeDesc desc)
Returns whether the exprNodeDesc can recommend name for the expression |
|
static boolean |
isRankingFunction(String name)
Use this to check if function is ranking function |
|
static boolean |
isStateful(GenericUDF genericUDF)
Returns whether a GenericUDF is stateful or not. |
|
static boolean |
isTableFunction(String name)
|
|
static int |
matchCost(TypeInfo argumentPassed,
TypeInfo argumentAccepted,
boolean exact)
Returns -1 if passed does not match accepted. |
|
static void |
registerFunctionsFromPluginJar(URL jarLocation,
ClassLoader classLoader)
Registers Hive functions from a plugin jar, using metadata from the jar's META-INF/class-info.xml. |
|
static void |
registerGenericUDAF(boolean isNative,
String functionName,
GenericUDAFResolver genericUDAFResolver)
|
|
static void |
registerGenericUDF(boolean isNative,
String functionName,
Class<? extends GenericUDF> genericUDFClass)
|
|
static void |
registerGenericUDTF(boolean isNative,
String functionName,
Class<? extends GenericUDTF> genericUDTFClass)
|
|
static void |
registerTableFunction(String name,
Class<? extends TableFunctionResolver> tFnCls)
|
|
static boolean |
registerTemporaryFunction(String functionName,
Class<?> udfClass)
Registers the appropriate kind of temporary function based on a class's type. |
|
static void |
registerTemporaryGenericUDAF(String functionName,
GenericUDAFResolver genericUDAFResolver)
|
|
static void |
registerTemporaryGenericUDF(String functionName,
Class<? extends GenericUDF> genericUDFClass)
|
|
static void |
registerTemporaryGenericUDTF(String functionName,
Class<? extends GenericUDTF> genericUDTFClass)
|
|
static void |
registerTemporaryMacro(String macroName,
ExprNodeDesc body,
List<String> colNames,
List<TypeInfo> colTypes)
Registers thae appropriate kind of temporary function based on a class's type. |
|
static void |
registerTemporaryUDAF(String functionName,
Class<? extends UDAF> udafClass)
|
|
static void |
registerTemporaryUDF(String functionName,
Class<? extends UDF> UDFClass,
boolean isOperator)
|
|
static void |
registerUDAF(boolean isNative,
String functionName,
Class<? extends UDAF> udafClass)
|
|
static void |
registerUDF(boolean isNative,
String functionName,
Class<? extends UDF> UDFClass,
boolean isOperator)
|
|
static void |
registerUDF(boolean isNative,
String functionName,
Class<? extends UDF> UDFClass,
boolean isOperator,
String displayName)
|
|
static void |
registerUDF(String functionName,
Class<? extends UDF> UDFClass,
boolean isOperator,
String displayName)
|
|
static void |
registerWindowFunction(String name,
GenericUDAFResolver wFn)
|
|
static void |
registerWindowFunction(String name,
GenericUDAFResolver wFn,
boolean registerAsUDAF)
Typically a WindowFunction is the same as a UDAF. |
|
static void |
unregisterTemporaryUDF(String functionName)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String LEAD_FUNC_NAME
public static final String LAG_FUNC_NAME
public static final String LAST_VALUE_FUNC_NAME
public static final String WINDOWING_TABLE_FUNCTION
public static final String NOOP_TABLE_FUNCTION
public static final String NOOP_MAP_TABLE_FUNCTION
Method Detail |
---|
public static void registerTemporaryUDF(String functionName, Class<? extends UDF> UDFClass, boolean isOperator)
public static void registerUDF(boolean isNative, String functionName, Class<? extends UDF> UDFClass, boolean isOperator)
public static void registerUDF(String functionName, Class<? extends UDF> UDFClass, boolean isOperator, String displayName)
public static void registerUDF(boolean isNative, String functionName, Class<? extends UDF> UDFClass, boolean isOperator, String displayName)
public static void registerTemporaryGenericUDF(String functionName, Class<? extends GenericUDF> genericUDFClass)
public static void registerGenericUDF(boolean isNative, String functionName, Class<? extends GenericUDF> genericUDFClass)
public static void registerTemporaryGenericUDTF(String functionName, Class<? extends GenericUDTF> genericUDTFClass)
public static void registerGenericUDTF(boolean isNative, String functionName, Class<? extends GenericUDTF> genericUDTFClass)
public static FunctionInfo getFunctionInfo(String functionName)
public static Set<String> getFunctionNames()
public static Hive getHive() throws HiveException
HiveException
public static Set<String> getFunctionNames(String funcPatternStr)
funcPatternStr
- regular expression of the interested function names
public static Set<String> getFunctionSynonyms(String funcName)
funcName
- the name of the function
public static boolean isNumericType(PrimitiveTypeInfo typeInfo)
typeInfo
-
public static boolean isExactNumericType(PrimitiveTypeInfo typeInfo)
typeInfo
-
public static TypeInfo getTypeInfoForPrimitiveCategory(PrimitiveTypeInfo a, PrimitiveTypeInfo b, PrimitiveObjectInspector.PrimitiveCategory typeCategory)
a
- TypeInfo of the first typeb
- TypeInfo of the second typetypeCategory
- PrimitiveCategory of the designated common type between a and b
public static TypeInfo getCommonClassForUnionAll(TypeInfo a, TypeInfo b)
public static TypeInfo getCommonClassForComparison(TypeInfo a, TypeInfo b)
public static PrimitiveObjectInspector.PrimitiveCategory getCommonCategory(TypeInfo a, TypeInfo b)
public static TypeInfo getCommonClass(TypeInfo a, TypeInfo b)
public static boolean implicitConvertable(PrimitiveObjectInspector.PrimitiveCategory from, PrimitiveObjectInspector.PrimitiveCategory to)
public static boolean implicitConvertable(TypeInfo from, TypeInfo to)
public static GenericUDAFEvaluator getGenericUDAFEvaluator(String name, List<ObjectInspector> argumentOIs, boolean isDistinct, boolean isAllColumns) throws SemanticException
name
- the name of the UDAFargumentOIs
- isDistinct
- isAllColumns
-
SemanticException
public static GenericUDAFEvaluator getGenericWindowingEvaluator(String name, List<ObjectInspector> argumentOIs, boolean isDistinct, boolean isAllColumns) throws SemanticException
SemanticException
public static <T> Method getMethodInternal(Class<? extends T> udfClass, String methodName, boolean exact, List<TypeInfo> argumentClasses) throws UDFArgumentException
UDFArgumentException
public static void registerTemporaryGenericUDAF(String functionName, GenericUDAFResolver genericUDAFResolver)
public static void registerGenericUDAF(boolean isNative, String functionName, GenericUDAFResolver genericUDAFResolver)
public static void registerTemporaryUDAF(String functionName, Class<? extends UDAF> udafClass)
public static void registerUDAF(boolean isNative, String functionName, Class<? extends UDAF> udafClass)
public static void unregisterTemporaryUDF(String functionName) throws HiveException
HiveException
public static GenericUDAFResolver getGenericUDAFResolver(String functionName)
public static Object invoke(Method m, Object thisObject, Object... arguments) throws HiveException
HiveException
public static int matchCost(TypeInfo argumentPassed, TypeInfo argumentAccepted, boolean exact)
public static Method getMethodInternal(Class<?> udfClass, List<Method> mlist, boolean exact, List<TypeInfo> argumentsPassed) throws UDFArgumentException
mlist
- The list of methods to inspect.exact
- Boolean to indicate whether this is an exact match or not.argumentsPassed
- The classes for the argument.
UDFArgumentException
public static GenericUDF getGenericUDFForIndex()
public static GenericUDF getGenericUDFForAnd()
public static GenericUDF cloneGenericUDF(GenericUDF genericUDF)
public static GenericUDTF cloneGenericUDTF(GenericUDTF genericUDTF)
public static boolean isDeterministic(GenericUDF genericUDF)
public static boolean isStateful(GenericUDF genericUDF)
public static boolean isOpAndOrNot(ExprNodeDesc desc)
public static boolean isOpAnd(ExprNodeDesc desc)
public static boolean isOpOr(ExprNodeDesc desc)
public static boolean isOpNot(ExprNodeDesc desc)
public static boolean isOpPositive(ExprNodeDesc desc)
public static boolean isOpPreserveInputName(ExprNodeDesc desc)
public static boolean registerTemporaryFunction(String functionName, Class<?> udfClass)
functionName
- name under which to register functionudfClass
- class implementing UD[A|T]F
public static void registerTemporaryMacro(String macroName, ExprNodeDesc body, List<String> colNames, List<TypeInfo> colTypes)
macroName
- name under which to register the macrobody
- the expression which the macro evaluates tocolNames
- the names of the arguments to the macrocolTypes
- the types of the arguments to the macropublic static void registerFunctionsFromPluginJar(URL jarLocation, ClassLoader classLoader) throws Exception
jarLocation
- URL for reading jar fileclassLoader
- classloader to use for loading function classes
Exception
public static void registerWindowFunction(String name, GenericUDAFResolver wFn)
public static void registerWindowFunction(String name, GenericUDAFResolver wFn, boolean registerAsUDAF)
name
- wFn
- registerAsUDAF
- public static WindowFunctionInfo getWindowFunctionInfo(String functionName)
public static boolean impliesOrder(String functionName)
name
- name of function
public static boolean isTableFunction(String name)
public static TableFunctionResolver getTableFunctionResolver(String name)
public static TableFunctionResolver getWindowingTableFunction()
public static TableFunctionResolver getNoopTableFunction()
public static void registerTableFunction(String name, Class<? extends TableFunctionResolver> tFnCls)
public static boolean isRankingFunction(String name)
name
- name of a function
public static boolean isNativeFuncExpr(ExprNodeGenericFuncDesc fnExpr)
fnExpr
- Function expression.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |