public static boolean isPermanentFunction(ExprNodeGenericFuncDesc fnExpr) {
    GenericUDF udf = fnExpr.getGenericUDF();
    if (udf == null) {
      return false;
    }

    Class<?> clazz = udf.getClass();
    if (udf instanceof GenericUDFBridge) {
      clazz = ((GenericUDFBridge)udf).getUdfClass();
    }

    if (clazz != null) {
      // Use session registry - see Registry.isPermanentFunc()
      return SessionState.getRegistryForWrite().isPermanentFunc(clazz);
    }
    return false;
  }
Registers the appropriate kind of temporary function based on a class's
type.

@param macroName name under which to register the macro

@param body the expression which the macro evaluates to
@param colNames the names of the arguments to the macro
@param colTypes the types of the arguments to the macro
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java