public Path getTempDirForInterimJobPath(Path path) {
    // For better write performance, we use HDFS for temporary data when object store is used.
    // Note that the scratch directory configuration variable must use HDFS or any other
    // non-blobstorage system to take advantage of this performance.
    boolean isBlobstorageOptimized = BlobStorageUtils.isBlobStoragePath(conf, path)
        && !BlobStorageUtils.isBlobStorageAsScratchDir(conf) && BlobStorageUtils.areOptimizationsEnabled(conf);

    if (isPathLocal(path) || isBlobstorageOptimized) {
      return getMRTmpPath();
    }
    return getExtTmpPathRelTo(path);
  }
Create a temporary directory depending of the path specified.
- If path is an Object store filesystem, then use the default MR scratch directory (HDFS), unless isFinalJob and
{@link BlobStorageUtils#areOptimizationsEnabled(Configuration)} are both true, then return a path on
the blobstore.
- If path is on HDFS, then create a staging directory inside the path

@param path Path used to verify the Filesystem to use for temporary directory

@return A path to the new temporary directory
ql/src/java/org/apache/hadoop/hive/ql/Context.java