Search in sources :

Example 1 with DropFunctionDesc

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);
}
Also used : DDLWork(org.apache.hadoop.hive.ql.ddl.DDLWork) DropFunctionDesc(org.apache.hadoop.hive.ql.ddl.function.drop.DropFunctionDesc) FunctionInfo(org.apache.hadoop.hive.ql.exec.FunctionInfo) DropFunctionMessage(org.apache.hadoop.hive.metastore.messaging.DropFunctionMessage)

Aggregations

DropFunctionMessage (org.apache.hadoop.hive.metastore.messaging.DropFunctionMessage)1 DDLWork (org.apache.hadoop.hive.ql.ddl.DDLWork)1 DropFunctionDesc (org.apache.hadoop.hive.ql.ddl.function.drop.DropFunctionDesc)1 FunctionInfo (org.apache.hadoop.hive.ql.exec.FunctionInfo)1