Search in sources :

Example 1 with DropTableCommand

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

the class DropTableReplicationTask method getDstWhCommands.

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

Example 2 with DropTableCommand

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

the class TestEximReplicationTasks method verifyDropTableReplicationTask.

private static void verifyDropTableReplicationTask(ReplicationTask rtask) throws IOException {
    assertEquals(DropTableReplicationTask.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(DropTableCommand.class, dstCommands.get(0).getClass());
    DropTableCommand dropTableCommand = new DropTableCommand(debugMapping.apply(rtask.getEvent().getDbName()), debugMapping.apply(rtask.getEvent().getTableName()), true, rtask.getEvent().getEventId());
    assertEquals(ReplicationUtils.serializeCommand(dropTableCommand), 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) DropTableCommand(org.apache.hive.hcatalog.api.repl.commands.DropTableCommand)

Aggregations

DropTableCommand (org.apache.hive.hcatalog.api.repl.commands.DropTableCommand)2 Command (org.apache.hive.hcatalog.api.repl.Command)1 DropDatabaseCommand (org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand)1 DropPartitionCommand (org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand)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