public ReplicationJob createJobForCopyTable(long auditLogId,long auditLogEntryCreateTime,Table table) throws StateUpdateException {
  ReplicationOperation replicationOperation=HiveUtils.isPartitioned(table) ? ReplicationOperation.COPY_PARTITIONED_TABLE : ReplicationOperation.COPY_UNPARTITIONED_TABLE;
  Map<String,String> extras=new HashMap<>();
  extras.put(PersistedJobInfo.AUDIT_LOG_ID_EXTRAS_KEY,Long.toString(auditLogId));
  extras.put(PersistedJobInfo.AUDIT_LOG_ENTRY_CREATE_TIME_KEY,Long.toString(auditLogEntryCreateTime));
  PersistedJobInfo persistedJobInfo=jobInfoStore.resilientCreate(replicationOperation,ReplicationStatus.PENDING,ReplicationUtils.getLocation(table),srcCluster.getName(),new HiveObjectSpec(table),Collections.emptyList(),ReplicationUtils.getTldt(table),Optional.empty(),Optional.empty(),extras);
  HiveObjectSpec spec=new HiveObjectSpec(table);
  Optional<Path> tableLocation=ReplicationUtils.getLocation(table);
switch (replicationOperation) {
case COPY_UNPARTITIONED_TABLE:
    return new ReplicationJob(conf,new CopyUnpartitionedTableTask(conf,destinationObjectFactory,objectConflictHandler,srcCluster,destCluster,spec,tableLocation,directoryCopier,true),onStateChangeHandler,persistedJobInfo);
case COPY_PARTITIONED_TABLE:
  return new ReplicationJob(conf,new CopyPartitionedTableTask(conf,destinationObjectFactory,objectConflictHandler,srcCluster,destCluster,spec,tableLocation),onStateChangeHandler,persistedJobInfo);
default :
throw new RuntimeException("Unhandled operation " + replicationOperation);
}
}

public ReplicationJob createJobForCopyTable ( long auditLogId , long auditLogEntryCreateTime , Table table ) throws StateUpdateException { ReplicationOperation replicationOperation = HiveUtils . isPartitioned ( table ) ? ReplicationOperation . COPY_PARTITIONED_TABLE : ReplicationOperation . COPY_UNPARTITIONED_TABLE ; Map < String , String > extras = new HashMap < > ( ) ; extras . put ( PersistedJobInfo . AUDIT_LOG_ID_EXTRAS_KEY , Long . toString ( auditLogId ) ) ; extras . put ( PersistedJobInfo . AUDIT_LOG_ENTRY_CREATE_TIME_KEY , Long . toString ( auditLogEntryCreateTime ) ) ; PersistedJobInfo persistedJobInfo = jobInfoStore . resilientCreate ( replicationOperation , ReplicationStatus . PENDING , ReplicationUtils . getLocation ( table ) , srcCluster . getName ( ) , new HiveObjectSpec ( table ) , Collections . emptyList ( ) , ReplicationUtils . getTldt ( table ) , Optional . empty ( ) , Optional . empty ( ) , extras ) ; HiveObjectSpec spec = new HiveObjectSpec ( table ) ; Optional < Path > tableLocation = ReplicationUtils . getLocation ( table ) ; switch ( replicationOperation ) { case COPY_UNPARTITIONED_TABLE : return new ReplicationJob ( conf , new CopyUnpartitionedTableTask ( conf , destinationObjectFactory , objectConflictHandler , srcCluster , destCluster , spec , tableLocation , directoryCopier , true ) , onStateChangeHandler , persistedJobInfo ) ; case COPY_PARTITIONED_TABLE : return new ReplicationJob ( conf , new CopyPartitionedTableTask ( conf , destinationObjectFactory , objectConflictHandler , srcCluster , destCluster , spec , tableLocation ) , onStateChangeHandler , persistedJobInfo ) ; default : throw new RuntimeException ( "Unhandled operation " + replicationOperation ) ; } }
create a replication job to copy a table .
