@Override
  public synchronized void process(Object row, int tag) throws HiveException {

    StructObjectInspector soi = parentObjInspectors[tag];
    List<? extends StructField> fields = parentFields[tag];

    if (needsTransform[tag] && outputRow.size() > 0) {
      for (int c = 0; c < fields.size(); c++) {
        outputRow.set(c, columnTypeResolvers[c].convertIfNecessary(soi
            .getStructFieldData(row, fields.get(c)), fields.get(c)
            .getFieldObjectInspector()));
      }
      forward(outputRow, outputObjInspector);
    } else {
      forward(row, inputObjInspectors[tag]);
    }
  }
UnionOperator will transform the input rows if the inputObjInspectors from
different parents are different. If one parent has exactly the same
ObjectInspector as the output ObjectInspector, then we don't need to do
transformation for that parent. This information is recorded in
needsTransform[].
ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java