Search in sources :

Example 1 with DropDatabaseCommand

use of org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand in project hive by apache.

the class DropDatabaseReplicationTask method getDstWhCommands.

public Iterable<? extends Command> getDstWhCommands() {
    verifyActionable();
    final String dstDbName = ReplicationUtils.mapIfMapAvailable(dropDatabaseMessage.getDB(), dbNameMapping);
    return Collections.singletonList(new DropDatabaseCommand(dstDbName, event.getEventId()));
}
Also used : DropDatabaseCommand(org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand)

Example 2 with DropDatabaseCommand

use of org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand in project hive by apache.

the class TestEximReplicationTasks method verifyDropDbReplicationTask.

private static void verifyDropDbReplicationTask(ReplicationTask rtask) throws IOException {
    assertEquals(DropDatabaseReplicationTask.class, rtask.getClass());
    assertEquals(false, rtask.needsStagingDirs());
    assertEquals(true, rtask.isActionable());
    rtask.withDbNameMapping(debugMapping).withTableNameMapping(debugMapping);
    for (Command c : rtask.getSrcWhCommands()) {
        assertEquals(NoopCommand.class, c.getClass());
    }
    List<? extends Command> dstCommands = Lists.newArrayList(rtask.getDstWhCommands());
    assertEquals(1, dstCommands.size());
    assertEquals(DropDatabaseCommand.class, dstCommands.get(0).getClass());
    DropDatabaseCommand dropDatabaseCommand = new DropDatabaseCommand(debugMapping.apply(rtask.getEvent().getDbName()), rtask.getEvent().getEventId());
    assertEquals(ReplicationUtils.serializeCommand(dropDatabaseCommand), ReplicationUtils.serializeCommand(dstCommands.get(0)));
}
Also used : ImportCommand(org.apache.hive.hcatalog.api.repl.commands.ImportCommand) DropTableCommand(org.apache.hive.hcatalog.api.repl.commands.DropTableCommand) ExportCommand(org.apache.hive.hcatalog.api.repl.commands.ExportCommand) Command(org.apache.hive.hcatalog.api.repl.Command) NoopCommand(org.apache.hive.hcatalog.api.repl.commands.NoopCommand) DropPartitionCommand(org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand) DropDatabaseCommand(org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand) DropDatabaseCommand(org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand)

Aggregations

DropDatabaseCommand (org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand)2 Command (org.apache.hive.hcatalog.api.repl.Command)1 DropPartitionCommand (org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand)1 DropTableCommand (org.apache.hive.hcatalog.api.repl.commands.DropTableCommand)1 ExportCommand (org.apache.hive.hcatalog.api.repl.commands.ExportCommand)1 ImportCommand (org.apache.hive.hcatalog.api.repl.commands.ImportCommand)1 NoopCommand (org.apache.hive.hcatalog.api.repl.commands.NoopCommand)1