public static void createTmpDirs(Configuration conf, MapWork mWork)
      throws IOException {

    Map<Path, List<String>> pa = mWork.getPathToAliases();
    if (MapUtils.isNotEmpty(pa)) {
      // common case: 1 table scan per map-work
      // rare case: smb joins
      HashSet<String> aliases = new HashSet<String>(1);
      List<Operator<? extends OperatorDesc>> ops =
          new ArrayList<Operator<? extends OperatorDesc>>();
      for (List<String> ls : pa.values()) {
        for (String a : ls) {
          aliases.add(a);
        }
      }
      for (String a : aliases) {
        ops.add(mWork.getAliasToWork().get(a));
      }
      createTmpDirs(conf, ops);
    }
  }
Hive uses tmp directories to capture the output of each FileSinkOperator.
This method creates all necessary tmp directories for FileSinks in the Mapwork.

@param conf Used to get the right FileSystem
@param mWork Used to find FileSinkOperators
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java