public static TezCounters mergeTezCounters(final TezCounters counter1, final TezCounters counter2) {
    TezCounters merged = new TezCounters();
    if (counter1 != null) {
      for (String counterGroup : counter1.getGroupNames()) {
        merged.addGroup(counter1.getGroup(counterGroup));
      }
    }

    if (counter2 != null) {
      for (String counterGroup : counter2.getGroupNames()) {
        merged.addGroup(counter2.getGroup(counterGroup));
      }
    }

    return merged;
  }
Merges two different tez counters into one

@param counter1 - tez counter 1
@param counter2 - tez counter 2
@return - merged tez counter
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/Utils.java