本文整理了Java中org.apache.hadoop.hive.ql.exec.Utilities.restoreSessionSpecifiedClassLoader()
方法的一些代码示例,展示了Utilities.restoreSessionSpecifiedClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.restoreSessionSpecifiedClassLoader()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.exec.Utilities
类名称:Utilities
方法名:restoreSessionSpecifiedClassLoader
暂无
代码示例来源:origin: apache/hive
Utilities.restoreSessionSpecifiedClassLoader(prev);
代码示例来源:origin: apache/drill
Utilities.restoreSessionSpecifiedClassLoader(prev);
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private FunctionInfo registerToSessionRegistry(String qualifiedName, FunctionInfo function) {
FunctionInfo ret = null;
ClassLoader prev = Utilities.getSessionSpecifiedClassLoader();
try {
// 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.
FunctionResource[] resources = function.getResources();
try {
FunctionTask.addFunctionResources(resources);
} catch (Exception e) {
LOG.error("Unable to load resources for " + qualifiedName + ":" + e, e);
return null;
}
ClassLoader loader = Utilities.getSessionSpecifiedClassLoader();
Class<?> udfClass = Class.forName(function.getClassName(), true, loader);
ret = FunctionRegistry.registerTemporaryUDF(qualifiedName, udfClass, resources);
if (ret == null) {
LOG.error(function.getClassName() + " is not a valid UDF class and was not registered.");
}
if (SessionState.get().isHiveServerQuery()) {
SessionState.getRegistryForWrite().addToUDFLoaders(loader);
}
} catch (ClassNotFoundException e) {
// Lookup of UDf class failed
LOG.error("Unable to load UDF class: " + e);
Utilities.restoreSessionSpecifiedClassLoader(prev);
}
function.shareStateWith(ret);
return ret;
}
内容来源于网络,如有侵权,请联系作者删除!