本文整理了Java中org.apache.hadoop.hive.ql.metadata.Hive.getFunction()
方法的一些代码示例,展示了Hive.getFunction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hive.getFunction()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.metadata.Hive
类名称:Hive
方法名:getFunction
暂无
代码示例来源:origin: apache/hive
public Tuple<org.apache.hadoop.hive.metastore.api.Function> function(final String name)
throws HiveException {
return new Tuple<>(functionForSpec, () -> db.getFunction(dbName, name));
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public static void reloadFunctions() throws HiveException {
Hive db = Hive.get();
for (String dbName : db.getAllDatabases()) {
for (String functionName : db.getFunctions(dbName, "*")) {
Function function = db.getFunction(dbName, functionName);
try {
FunctionRegistry.registerPermanentFunction(
FunctionUtils.qualifyFunctionName(functionName, dbName), function.getClassName(),
false, FunctionTask.toFunctionResource(function.getResourceUris()));
} catch (Exception e) {
LOG.warn("Failed to register persistent function " +
functionName + ":" + function.getClassName() + ". Ignore and continue.");
}
}
}
}
代码示例来源:origin: apache/hive
private boolean isFunctionAlreadyLoaded(Path funcDumpRoot) throws HiveException, IOException {
Path metadataPath = new Path(funcDumpRoot, EximUtil.METADATA_NAME);
FileSystem fs = FileSystem.get(metadataPath.toUri(), context.hiveConf);
MetaData metadata = EximUtil.readMetaData(fs, metadataPath);
Function function;
try {
String dbName = StringUtils.isBlank(dbNameToLoadIn) ? metadata.function.getDbName() : dbNameToLoadIn;
function = context.hiveDb.getFunction(dbName, metadata.function.getFunctionName());
} catch (HiveException e) {
if (e.getCause() instanceof NoSuchObjectException) {
return false;
}
throw e;
}
return (function != null);
}
代码示例来源:origin: apache/hive
/**
* This is called outside of the lock. Some of the methods that are called transitively by
* this (e.g. addFunction) will take the lock again and then release it, which is ok.
*/
private FunctionInfo getFunctionInfoFromMetastoreNoLock(String functionName, HiveConf conf) {
try {
String[] parts = FunctionUtils.getQualifiedFunctionNameParts(functionName);
Function func = Hive.get(conf).getFunction(parts[0].toLowerCase(), parts[1]);
if (func == null) {
return null;
}
// Found UDF in metastore - now add it to the function registry.
FunctionInfo fi = registerPermanentFunction(functionName, func.getClassName(), true,
FunctionTask.toFunctionResource(func.getResourceUris()));
if (fi == null) {
LOG.error(func.getClassName() + " is not a valid UDF class and was not registered");
return null;
}
return fi;
} catch (Throwable e) {
LOG.info("Unable to look up " + functionName + " in metastore", e);
}
return null;
}
}
代码示例来源:origin: apache/drill
/**
* This is called outside of the lock. Some of the methods that are called transitively by
* this (e.g. addFunction) will take the lock again and then release it, which is ok.
*/
private FunctionInfo getFunctionInfoFromMetastoreNoLock(String functionName, HiveConf conf) {
try {
String[] parts = FunctionUtils.getQualifiedFunctionNameParts(functionName);
Function func = Hive.get(conf).getFunction(parts[0].toLowerCase(), parts[1]);
if (func == null) {
return null;
}
// Found UDF in metastore - now add it to the function registry.
FunctionInfo fi = registerPermanentFunction(functionName, func.getClassName(), true,
FunctionTask.toFunctionResource(func.getResourceUris()));
if (fi == null) {
LOG.error(func.getClassName() + " is not a valid UDF class and was not registered");
return null;
}
return fi;
} catch (Throwable e) {
LOG.info("Unable to look up " + functionName + " in metastore", e);
}
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!