fName = functionName;
}
// Try looking up function in the metastore
HiveConf conf = SessionState.get().getConf();
Function func = Hive.get(conf).getFunction(dbName, fName);
if (func != null) {
// Found UDF in metastore - now add it to the function registry
// At this point we should add any relevant jars that would be needed for the UDf.
try {
FunctionTask.addFunctionResources(func.getResourceUris());
} catch (Exception e) {
LOG.error("Unable to load resources for " + dbName + "." + fName + ":" + e);
return null;
}
Class<?> udfClass = Class.forName(func.getClassName(), true, JavaUtils.getClassLoader());
if (registerTemporaryFunction(functionName, udfClass)) {
ret = mFunctions.get(functionName);
} else {
LOG.error(func.getClassName() + " is not a valid UDF class and was not registered.");
}
}
} catch (HiveException e) {
LOG.info("Unable to lookup UDF in metastore: " + e);
} catch (ClassNotFoundException e) {