private WriteEntity.WriteType determineWriteType(LoadTableDesc ltd, String dest) {

    if (ltd == null) {
      return WriteEntity.WriteType.INSERT_OVERWRITE;
    }
    return ((ltd.getLoadFileType() == LoadFileType.REPLACE_ALL || ltd
        .isInsertOverwrite()) ? WriteEntity.WriteType.INSERT_OVERWRITE : getWriteType(dest));

  }
Construct the data structures containing ExprNodeDesc for partition
columns and order columns. Use the input definition to construct the list
of output columns for the ReduceSinkOperator
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java