@ VisibleForTesting public boolean copyPartitionParams ( String completeSourcePartitionName , String completeDestPartitionName , List < String > whitelist , List < String > blacklist ) { Optional < Partition > sourcePartitionOptional = getPartitionObject ( completeSourcePartitionName ) ; Optional < Partition > destPartitionOptional = getPartitionObject ( completeDestPartitionName ) ; if ( ( ! sourcePartitionOptional . isPresent ( ) ) || ( ! destPartitionOptional . isPresent ( ) ) ) { return false ; } Map < String , String > sourceParams = sourcePartitionOptional . get ( ) . getParameters ( ) ; Map < String , String > destParams = destPartitionOptional . get ( ) . getParameters ( ) ; for ( Map . Entry < String , String > param : sourceParams . entrySet ( ) ) { if ( ! matched ( whitelist , blacklist , param . getKey ( ) ) ) { continue ; } destParams . put ( param . getKey ( ) , param . getValue ( ) ) ; } destPartitionOptional . get ( ) . setParameters ( destParams ) ; if ( ! dropPartition ( completeDestPartitionName ) ) { return false ; } if ( ! addPartition ( destPartitionOptional . get ( ) , completeDestPartitionName ) ) { return false ; } return true ; }
Method to copy partition parameters from source partition to destination partition