deniskuzZ commented on code in PR #6447:
URL: https://github.com/apache/hive/pull/6447#discussion_r3136370242
##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/function/drop/DropFunctionAnalyzer.java:
##########
@@ -41,19 +44,33 @@ public DropFunctionAnalyzer(QueryState queryState) throws
SemanticException {
super(queryState);
}
+ public DropFunctionAnalyzer(QueryState queryState, Hive db) throws
SemanticException {
+ super(queryState, db);
+ }
+
+ protected FunctionInfo getFunctionInfo(String functionName) throws
SemanticException {
+ return FunctionRegistry.getFunctionInfo(functionName);
+ }
+
@Override
public void analyzeInternal(ASTNode root) throws SemanticException {
String functionName = root.getChild(0).getText();
boolean ifExists = (root.getFirstChildWithType(HiveParser.TOK_IFEXISTS) !=
null);
boolean throwException = !ifExists && !HiveConf.getBoolVar(conf,
ConfVars.DROP_IGNORES_NON_EXISTENT);
boolean isTemporary =
(root.getFirstChildWithType(HiveParser.TOK_TEMPORARY) != null);
- FunctionInfo info = FunctionRegistry.getFunctionInfo(functionName);
+ FunctionInfo info = getFunctionInfo(functionName);
if (info == null) {
- if (throwException) {
+ // getFunctionInfo returns null when the function's JAR resource cannot
be loaded (e.g. the
+ // HDFS file was deleted). For permanent functions fall back to a direct
metastore lookup so
+ // that an orphaned definition can still be removed without the JAR
being present.
+ if (!isTemporary && functionExistsInMetastore(functionName)) {
Review Comment:
could we refactor the upper function to return all fns registered in HMS?
not sure, but i think function registry should handle that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]