private static boolean isTempPath(FileStatus file) {
    String name = file.getPath().getName();
    // in addition to detecting hive temporary files, we also check hadoop
    // temporary folders that used to show up in older releases
    return (name.startsWith("_task") || name.startsWith(tmpPrefix) || name.startsWith(hadoopTmpPrefix));
  }
Detect if the supplied file is a temporary path.
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java