public static boolean shouldAvoidRename(FileSinkDesc conf, Configuration hConf) {
    // we are avoiding rename/move only if following conditions are met
    //  * execution engine is tez
    //  * if it is select query
    if (conf != null && conf.getIsQuery() && conf.getFilesToFetch() != null
        && HiveConf.getVar(hConf, ConfVars.HIVE_EXECUTION_ENGINE).equalsIgnoreCase("tez")){
      return true;
    }
    return false;
  }
Replace the oldTaskId appearing in the filename by the newTaskId. The string oldTaskId could
appear multiple times, we should only replace the last one.

@param filename
@param oldTaskId
@param newTaskId
@return
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java