public void unregisterFunction(String functionName) throws HiveException { lock.lock(); try { functionName = functionName.toLowerCase(); FunctionInfo fi = mFunctions.get(functionName); if (fi != null) { if (fi.isBuiltIn()) { throw new HiveException(ErrorMsg.DROP_NATIVE_FUNCTION.getMsg(functionName)); } mFunctions.remove(functionName); fi.discarded(); if (fi.isPersistent()) { removePersistentFunctionUnderLock(fi); } } } finally { lock.unlock(); } }
public void unregisterFunction(String functionName) throws HiveException { lock.lock(); try { functionName = functionName.toLowerCase(); FunctionInfo fi = mFunctions.get(functionName); if (fi != null) { if (fi.isBuiltIn()) { throw new HiveException(ErrorMsg.DROP_NATIVE_FUNCTION.getMsg(functionName)); } mFunctions.remove(functionName); fi.discarded(); if (fi.isPersistent()) { removePersistentFunctionUnderLock(fi); } } } finally { lock.unlock(); } }
throw new RuntimeException(message); prev.discarded();
"which cannot be overridden."); prev.discarded();
public synchronized void unregisterFunction(String functionName) throws HiveException { functionName = functionName.toLowerCase(); FunctionInfo fi = mFunctions.get(functionName); if (fi != null) { if (fi.isBuiltIn()) { throw new HiveException(ErrorMsg.DROP_NATIVE_FUNCTION.getMsg(functionName)); } mFunctions.remove(functionName); fi.discarded(); } }
private synchronized void addFunction(String functionName, FunctionInfo function) { if (isNative ^ function.isNative()) { throw new RuntimeException("Function " + functionName + " is not for this registry"); } functionName = functionName.toLowerCase(); FunctionInfo prev = mFunctions.get(functionName); if (prev != null) { if (isBuiltInFunc(prev.getFunctionClass())) { throw new RuntimeException("Function " + functionName + " is hive builtin function, " + "which cannot be overriden."); } prev.discarded(); } mFunctions.put(functionName, function); if (function.isBuiltIn()) { builtIns.add(function.getFunctionClass()); } }