public Path getExternalTmpPath(Path path) {
    URI extURI = path.toUri();
    if ("viewfs".equals(extURI.getScheme())) {
      // if we are on viewfs we don't want to use /tmp as tmp dir since rename from /tmp/..
      // to final /user/hive/warehouse/ will fail later, so instead pick tmp dir
      // on same namespace as tbl dir.
      return getExtTmpPathRelTo(path.getParent());
    }
    return new Path(getExternalScratchDir(extURI), EXT_PREFIX + nextPathId());
  }
Get a path to store tmp data destined for external Path.

@param path external Path to which the tmp data has to be eventually moved
@return next available tmp path on the file system corresponding extURI
ql/src/java/org/apache/hadoop/hive/ql/Context.java