Search in sources :

Example 1 with DropPartitionCommand

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);
}
Also used : DropPartitionCommand(org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand) 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)

Example 2 with DropPartitionCommand

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());
        }
    });
}
Also used : DropPartitionCommand(org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand) 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) Map(java.util.Map)

Aggregations

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