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());
}
});
}
Aggregations