public static String replaceHost(String originalURIStr, String newHost) throws SemanticException {
    if (StringUtils.isEmpty(originalURIStr)) {
      return originalURIStr;
    }
    try {
      URI origUri = new Path(originalURIStr).toUri();
      return new Path(new URI(origUri.getScheme(),
              origUri.getUserInfo(), newHost, origUri.getPort(),
              origUri.getPath(), origUri.getQuery(),
              origUri.getFragment())).toString();
    } catch (URISyntaxException ex) {
      throw new SemanticException(ex);
    }
  }
Given a ReplChangeManger's encoded uri, it replaces the nameservice and returns the modified encoded uri.
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/Utils.java