Search in sources :

Example 11 with Command

use of org.apache.hive.hcatalog.api.repl.Command 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)

Example 12 with Command

use of org.apache.hive.hcatalog.api.repl.Command 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

Command (org.apache.hive.hcatalog.api.repl.Command)12 NoopCommand (org.apache.hive.hcatalog.api.repl.commands.NoopCommand)6 Test (org.junit.Test)6 IOException (java.io.IOException)5 DropPartitionCommand (org.apache.hive.hcatalog.api.repl.commands.DropPartitionCommand)5 ExportCommand (org.apache.hive.hcatalog.api.repl.commands.ExportCommand)5 ImportCommand (org.apache.hive.hcatalog.api.repl.commands.ImportCommand)5 HashMap (java.util.HashMap)4 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)4 CommandNeedRetryException (org.apache.hadoop.hive.ql.CommandNeedRetryException)4 ObjectNotFoundException (org.apache.hive.hcatalog.api.ObjectNotFoundException)4 DropDatabaseCommand (org.apache.hive.hcatalog.api.repl.commands.DropDatabaseCommand)4 DropTableCommand (org.apache.hive.hcatalog.api.repl.commands.DropTableCommand)4 HCatException (org.apache.hive.hcatalog.common.HCatException)4 Map (java.util.Map)3 HCatTable (org.apache.hive.hcatalog.api.HCatTable)3 HCatFieldSchema (org.apache.hive.hcatalog.data.schema.HCatFieldSchema)3 HCatPartition (org.apache.hive.hcatalog.api.HCatPartition)2 Function (com.google.common.base.Function)1 ArrayList (java.util.ArrayList)1