public static List < String > getBackupQueries ( PurgeableHivePartitionDataset dataset ) { List < String > queries = new ArrayList <> ( ) ; queries . add ( getUseDbQuery ( dataset . getDbName ( ) ) ) ; queries . add ( getCreateTableQuery ( dataset . getCompleteBackupTableName ( ) , dataset . getDbName ( ) , dataset . getTableName ( ) , dataset . getBackupTableLocation ( ) ) ) ; Optional < String > fileFormat = Optional . absent ( ) ; if ( dataset . getSpecifyPartitionFormat ( ) ) { fileFormat = dataset . getFileFormat ( ) ; } queries . add ( getAddPartitionQuery ( dataset . getBackupTableName ( ) , PartitionUtils . getPartitionSpecString ( dataset . getSpec ( ) ) , fileFormat , Optional . fromNullable ( dataset . getOriginalPartitionLocation ( ) ) ) ) ; return queries ; }
Will return all the queries needed to have a backup table partition pointing to the original partition data location