code: @VisibleForTesting
    protected static boolean shouldReplacePartition(Config config,
        String replacedPartitionDbName, String replacedPartitionTableName,
        Optional<String> replacementPartitionDbName, Optional<String> replacementPartitionTableName) {
      // If disabled explicitly, rest does not matters
      boolean shouldReplacePartition = ConfigUtils.getBoolean(config, SHOULD_REPLACE_PARTITION_KEY, false);
  
      // If any of the replacement DB name or replacement Table name is missing, then do not replace partition
      if (!replacementPartitionDbName.isPresent() || !replacementPartitionTableName.isPresent()) {
        return false;
      }
      // If not disabled explicitly, check if source db / table are same as the replacement partition's db / table
      // .. if so, do not try replacement.
      else {
        return shouldReplacePartition
            && !(replacedPartitionDbName.equalsIgnoreCase(replacementPartitionDbName.get()) &&
            replacedPartitionTableName.equalsIgnoreCase(replacementPartitionTableName.get()));
      }
    }
docs: *
  Determine if a partition should be replaced-in from another table for a partition being deleted from
  the current table.
  
  @param config                          Config to get check if partition replacement is enabled.
  @param replacedPartitionDbName         Database name for the table from where partition is being deleted.
  @param replacedPartitionTableName      Table name from where partition is being deleted.
  @param replacementPartitionDbName      Database name from where the partition should be registered.
  @param replacementPartitionTableName   Table name from where the partition should be registered.
  @return  True if partition should be replaced-in from another table.