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()));
}
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)));
}
Aggregations