org.apache.hadoop.hive.ql.exec.Utilities.restoreSessionSpecifiedClassLoader()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(109)

本文整理了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

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;
}

相关文章

Utilities类方法