@Override
  public void endGroup() throws HiveException {
    if (childOperators == null) {
      return;
    }

    // We will start a new key group. We can call flush the buffer
    // of children from lastChildIndex (inclusive) to the last child and
    // propagate processGroup to those children.
    for (int i = lastChildIndex; i < childOperatorsArray.length; i++) {
      Operator<? extends OperatorDesc> child = childOperatorsArray[i];
      child.flush();
      child.endGroup();
      for (int childTag: newChildOperatorsTag[i]) {
        child.processGroup(childTag);
      }
    }
  }
We assume that the input rows associated with the same key are ordered by
the tag. Because a tag maps to a childindex, when we see a new childIndex,
we will not see the last childIndex (lastChildIndex) again before we start
a new key group. So, we can call flush the buffer of children
from lastChildIndex (inclusive) to currentChildIndex (exclusive) and
propagate processGroup to those children.
@param currentChildIndex the childIndex we have right now.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/exec/DemuxOperator.java