class AvgDistinct extends SumDistinct {

  @Override
  public Object terminate() {
    double sum = ((Number) super.terminate()).doubleValue();
    double result = sum / this.distinct.size();
    return downCast(result);
  }

}