public Double terminate() {
      // This is SQL standard - average of zero items should be null.
      return state.mCount == 0 ? null : Double.valueOf(state.mSum
          / state.mCount);
    }
Terminates the aggregation and return the final result.
contrib/src/java/org/apache/hadoop/hive/contrib/udaf/example/UDAFExampleAvg.java