use of org.apache.hadoop.hive.ql.ddl.function.drop.DropFunctionDesc in project hive by apache.
the class DropFunctionHandler method handle.
@Override
public List<Task<?>> handle(Context context) throws SemanticException {
DropFunctionMessage msg = deserializer.getDropFunctionMessage(context.dmd.getPayload());
String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName;
String qualifiedFunctionName = FunctionUtils.qualifyFunctionName(msg.getFunctionName(), actualDbName);
// When the load is invoked via Scheduler's executor route, the function resources will not be
// there in classpath. Processing drop function event tries to unregister the function resulting
// in ClassNotFoundException being thrown in such case.
// Obtaining FunctionInfo object from FunctionRegistry will add the function's resources URLs to UDFClassLoader.
FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo(qualifiedFunctionName);
DropFunctionDesc desc = new DropFunctionDesc(qualifiedFunctionName, false, context.eventOnlyReplicationSpec());
Task<DDLWork> dropFunctionTask = TaskFactory.get(new DDLWork(readEntitySet, writeEntitySet, desc, true, context.getDumpDirectory(), context.getMetricCollector()), context.hiveConf);
context.log.debug("Added drop function task : {}:{}", dropFunctionTask.getId(), desc.getName());
updatedMetadata.set(context.dmd.getEventTo().toString(), actualDbName, null, null);
return Collections.singletonList(dropFunctionTask);
}
Aggregations