org.apache.hadoop.hive.ql.metadata.Hive.dropFunction()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.apache.hadoop.hive.ql.metadata.Hive.dropFunction()方法的一些代码示例,展示了Hive.dropFunction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hive.dropFunction()方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.metadata.Hive
类名称:Hive
方法名:dropFunction

Hive.dropFunction介绍

暂无

代码示例

代码示例来源:origin: apache/hive

private int dropPermanentFunction(Hive db, DropFunctionDesc dropFunctionDesc) {
 try {
  String[] qualifiedNameParts = FunctionUtils.getQualifiedFunctionNameParts(
    dropFunctionDesc.getFunctionName());
  String dbName = qualifiedNameParts[0];
  String funcName = qualifiedNameParts[1];
  String registeredName = FunctionUtils.qualifyFunctionName(funcName, dbName);
  FunctionRegistry.unregisterPermanentFunction(registeredName);
  db.dropFunction(dbName, funcName);
  return 0;
 } catch (Exception e) {
  // For repl load flow, function may not exist for first incremental phase. So, just return success.
  if (dropFunctionDesc.getReplicationSpec().isInReplicationScope()
      && (e.getCause() instanceof NoSuchObjectException)) {
   LOG.info("Drop function is idempotent as function: "
       + dropFunctionDesc.getFunctionName() + " doesn't exist.");
   return 0;
  }
  LOG.info("drop function: ", e);
  console.printError("FAILED: error during drop function: " + StringUtils.stringifyException(e));
  return 1;
 }
}

代码示例来源:origin: apache/drill

private int dropPermanentFunction(Hive db, DropFunctionDesc dropFunctionDesc) {
 try {
  String[] qualifiedNameParts = FunctionUtils.getQualifiedFunctionNameParts(
    dropFunctionDesc.getFunctionName());
  String dbName = qualifiedNameParts[0];
  String funcName = qualifiedNameParts[1];
  String registeredName = FunctionUtils.qualifyFunctionName(funcName, dbName);
  FunctionRegistry.unregisterPermanentFunction(registeredName);
  db.dropFunction(dbName, funcName);
  return 0;
 } catch (Exception e) {
  LOG.info("drop function: " + StringUtils.stringifyException(e));
  console.printError("FAILED: error during drop function: " + StringUtils.stringifyException(e));
  return 1;
 }
}

代码示例来源:origin: apache/phoenix

public void clearUDFsCreatedDuringTests() throws Exception {
 if (System.getenv(QTEST_LEAVE_FILES) != null) {
  return;
 }
 // Delete functions created by the tests
 // It is enough to remove functions from the default database, other databases are dropped
 for (String udfName : db.getFunctions(DEFAULT_DATABASE_NAME, ".*")) {
  if (!srcUDFs.contains(udfName)) {
   db.dropFunction(DEFAULT_DATABASE_NAME, udfName);
  }
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

private int dropPermanentFunction(Hive db, DropFunctionDesc dropFunctionDesc) {
 try {
  String[] qualifiedNameParts = FunctionUtils.getQualifiedFunctionNameParts(
    dropFunctionDesc.getFunctionName());
  String dbName = qualifiedNameParts[0];
  String funcName = qualifiedNameParts[1];
  String registeredName = FunctionUtils.qualifyFunctionName(funcName, dbName);
  FunctionRegistry.unregisterPermanentFunction(registeredName);
  db.dropFunction(dbName, funcName);
  return 0;
 } catch (Exception e) {
  LOG.info("drop function: " + StringUtils.stringifyException(e));
  console.printError("FAILED: error during drop function: " + StringUtils.stringifyException(e));
  return 1;
 }
}

相关文章

微信公众号

最新文章

更多

Hive类方法