use of org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand in project hive by apache.
the class TestEximReplicationTasks method verifyDropPartitionReplicationTask.
private static void verifyDropPartitionReplicationTask(ReplicationTask rtask, Table table, Partition ptn) {
assertEquals(DropPartitionReplicationTask.class, rtask.getClass());
assertEquals(false, rtask.needsStagingDirs());
assertEquals(true, rtask.isActionable());
rtask.withDbNameMapping(debugMapping).withTableNameMapping(debugMapping);
assertEquals(true, rtask.isActionable());
for (Command c : rtask.getSrcWhCommands()) {
assertEquals(NoopCommand.class, c.getClass());
}
List<? extends Command> dstCommands = Lists.newArrayList(rtask.getDstWhCommands());
assertEquals(1, dstCommands.size());
assertEquals(DropPartitionCommand.class, dstCommands.get(0).getClass());
DropPartitionCommand dropPartitionCommand = new DropPartitionCommand(debugMapping.apply(rtask.getEvent().getDbName()), debugMapping.apply(rtask.getEvent().getTableName()), getPtnDesc(table, ptn), true, rtask.getEvent().getEventId());
CommandTestUtils.compareCommands(dropPartitionCommand, dstCommands.get(0), true);
}
use of org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand in project hive by apache.
the class DropPartitionReplicationTask method getDstWhCommands.
public Iterable<? extends Command> getDstWhCommands() {
verifyActionable();
final String dstDbName = ReplicationUtils.mapIfMapAvailable(dropPartitionMessage.getDB(), dbNameMapping);
final String dstTableName = ReplicationUtils.mapIfMapAvailable(dropPartitionMessage.getTable(), tableNameMapping);
return Iterables.transform(dropPartitionMessage.getPartitions(), new Function<Map<String, String>, Command>() {
@Override
public Command apply(@Nullable Map<String, String> ptnDesc) {
return new DropPartitionCommand(dstDbName, dstTableName, ptnDesc, true, event.getEventId());
}
});
}
Aggregations