Search in sources :

Example 1 with NoopCommand

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

the class AddPartitionReplicationTask method getDstWhCommands.

public Iterable<? extends Command> getDstWhCommands() {
    verifyActionable();
    if (addPartitionMessage.getPartitions().isEmpty()) {
        return Collections.singletonList(new NoopCommand(event.getEventId()));
    }
    final String dstDbName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getDB(), dbNameMapping);
    final String dstTableName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getTable(), tableNameMapping);
    return Iterables.transform(addPartitionMessage.getPartitions(), new Function<Map<String, String>, Command>() {

        @Override
        public Command apply(@Nullable Map<String, String> ptnDesc) {
            return new ImportCommand(dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory(ReplicationUtils.getUniqueKey(getEvent().getEventId(), // Note - important to retain the same key as the export
            addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc)), false, event.getEventId());
        }
    });
}
Also used : ImportCommand(org.apache.hive.hcatalog.api.repl.commands.ImportCommand) Command(org.apache.hive.hcatalog.api.repl.Command) NoopCommand(org.apache.hive.hcatalog.api.repl.commands.NoopCommand) ImportCommand(org.apache.hive.hcatalog.api.repl.commands.ImportCommand) ExportCommand(org.apache.hive.hcatalog.api.repl.commands.ExportCommand) NoopCommand(org.apache.hive.hcatalog.api.repl.commands.NoopCommand) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 Command (org.apache.hive.hcatalog.api.repl.Command)1 ExportCommand (org.apache.hive.hcatalog.api.repl.commands.ExportCommand)1 ImportCommand (org.apache.hive.hcatalog.api.repl.commands.ImportCommand)1 NoopCommand (org.apache.hive.hcatalog.api.repl.commands.NoopCommand)1