/** * Looks up the function name in the registry. If enabled, will attempt to search the metastore * for the function. * @param functionName * @return */ public FunctionInfo getFunctionInfo(String functionName) throws SemanticException { lock.lock(); try { functionName = functionName.toLowerCase(); if (FunctionUtils.isQualifiedFunctionName(functionName)) { return getQualifiedFunctionInfoUnderLock(functionName); } // First try without qualifiers - would resolve builtin/temp functions. // Otherwise try qualifying with current db name. FunctionInfo functionInfo = mFunctions.get(functionName); if (functionInfo != null && functionInfo.isBlockedFunction()) { throw new SemanticException ("UDF " + functionName + " is not allowed"); } if (functionInfo == null) { String qualifiedName = FunctionUtils.qualifyFunctionName( functionName, SessionState.get().getCurrentDatabase().toLowerCase()); functionInfo = getQualifiedFunctionInfoUnderLock(qualifiedName); } return functionInfo; } finally { lock.unlock(); } }
if (functionInfo != null && functionInfo.isBlockedFunction()) { throw new SemanticException ("UDF " + functionName + " is not allowed");
private FunctionInfo getQualifiedFunctionInfoUnderLock(String qualifiedName) throws SemanticException { FunctionInfo info = mFunctions.get(qualifiedName); if (info != null && info.isBlockedFunction()) { throw new SemanticException ("UDF " + qualifiedName + " is not allowed");
private FunctionInfo getQualifiedFunctionInfoUnderLock(String qualifiedName) throws SemanticException { FunctionInfo info = mFunctions.get(qualifiedName); if (info != null && info.isBlockedFunction()) { throw new SemanticException ("UDF " + qualifiedName + " is not allowed");
private FunctionInfo getQualifiedFunctionInfo(String qualifiedName) throws SemanticException { FunctionInfo info = mFunctions.get(qualifiedName); if (info != null && info.isBlockedFunction()) { throw new SemanticException ("UDF " + qualifiedName + " is not allowed"); } if (!isNative && info != null && info.isDiscarded()) { // the persistent function is discarded. try reload mFunctions.remove(qualifiedName); return null; } // HIVE-6672: In HiveServer2 the JARs for this UDF may have been loaded by a different thread, // and the current thread may not be able to resolve the UDF. Test for this condition // and if necessary load the JARs in this thread. if (isNative && info != null && info.isPersistent()) { return registerToSessionRegistry(qualifiedName, info); } return info; }
/** * Looks up the function name in the registry. If enabled, will attempt to search the metastore * for the function. * @param functionName * @return */ public synchronized FunctionInfo getFunctionInfo(String functionName) throws SemanticException { functionName = functionName.toLowerCase(); if (FunctionUtils.isQualifiedFunctionName(functionName)) { return getQualifiedFunctionInfo(functionName); } // First try without qualifiers - would resolve builtin/temp functions. // Otherwise try qualifying with current db name. FunctionInfo functionInfo = mFunctions.get(functionName); if (functionInfo != null && functionInfo.isBlockedFunction()) { throw new SemanticException ("UDF " + functionName + " is not allowed"); } if (functionInfo == null) { String qualifiedName = FunctionUtils.qualifyFunctionName( functionName, SessionState.get().getCurrentDatabase().toLowerCase()); functionInfo = getQualifiedFunctionInfo(qualifiedName); } return functionInfo; }