Search in sources :

Example 6 with ExportCommand

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

the class TestEximReplicationTasks method verifyAlterTableReplicationTask.

private static void verifyAlterTableReplicationTask(ReplicationTask rtask) throws IOException {
    assertEquals(AlterTableReplicationTask.class, rtask.getClass());
    assertEquals(true, rtask.needsStagingDirs());
    assertEquals(false, rtask.isActionable());
    rtask.withSrcStagingDirProvider(stagingDirectoryProvider).withDstStagingDirProvider(stagingDirectoryProvider).withDbNameMapping(debugMapping).withTableNameMapping(debugMapping);
    assertEquals(true, rtask.isActionable());
    List<? extends Command> srcCommands = Lists.newArrayList(rtask.getSrcWhCommands());
    assertEquals(1, srcCommands.size());
    assertEquals(ExportCommand.class, srcCommands.get(0).getClass());
    ExportCommand exportCommand = getExpectedExportCommand(rtask, null, true);
    assertEquals(ReplicationUtils.serializeCommand(exportCommand), ReplicationUtils.serializeCommand(srcCommands.get(0)));
    List<? extends Command> dstCommands = Lists.newArrayList(rtask.getDstWhCommands());
    assertEquals(1, dstCommands.size());
    assertEquals(ImportCommand.class, dstCommands.get(0).getClass());
    ImportCommand importCommand = getExpectedImportCommand(rtask, null, true);
    assertEquals(ReplicationUtils.serializeCommand(importCommand), ReplicationUtils.serializeCommand(dstCommands.get(0)));
}
Also used : ImportCommand(org.apache.hive.hcatalog.api.repl.commands.ImportCommand) ExportCommand(org.apache.hive.hcatalog.api.repl.commands.ExportCommand)

Example 7 with ExportCommand

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

the class AlterTableReplicationTask method getSrcWhCommands.

public Iterable<? extends Command> getSrcWhCommands() {
    verifyActionable();
    final String dbName = alterTableMessage.getDB();
    final String tableName = alterTableMessage.getTable();
    return Collections.singletonList(new ExportCommand(dbName, tableName, null, srcStagingDirProvider.getStagingDirectory(ReplicationUtils.getUniqueKey(getEvent().getEventId(), dbName, tableName, null)), true, event.getEventId()));
}
Also used : ExportCommand(org.apache.hive.hcatalog.api.repl.commands.ExportCommand)

Example 8 with ExportCommand

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

the class InsertReplicationTask method getSrcWhCommands.

@Override
public Iterable<? extends Command> getSrcWhCommands() {
    verifyActionable();
    final String dbName = insertMessage.getDB();
    final String tableName = insertMessage.getTable();
    final Map<String, String> ptnDesc = insertMessage.getPartitionKeyValues();
    return Collections.singletonList(new ExportCommand(dbName, tableName, ptnDesc, srcStagingDirProvider.getStagingDirectory(ReplicationUtils.getUniqueKey(getEvent().getEventId(), dbName, tableName, ptnDesc)), false, event.getEventId()));
}
Also used : ExportCommand(org.apache.hive.hcatalog.api.repl.commands.ExportCommand)

Aggregations

ExportCommand (org.apache.hive.hcatalog.api.repl.commands.ExportCommand)8 ImportCommand (org.apache.hive.hcatalog.api.repl.commands.ImportCommand)5