@@ -0,0 +1,981 @@
+package com.facebook.presto.aggregations;%0A%0Aimport com.facebook.presto.PositionBlock;%0Aimport com.facebook.presto.Tuple;%0Aimport com.facebook.presto.TupleInfo;%0Aimport com.facebook.presto.ValueBlock;%0A%0Apublic class AverageAggregation%0A    implements AggregationFunction%0A%7B%0A    private long sum;%0A    private long count;%0A%0A    @Override%0A    public TupleInfo getTupleInfo()%0A    %7B%0A        // TODO: value should be float (?)%0A        return new TupleInfo(TupleInfo.Type.FIXED_INT_64);%0A    %7D%0A%0A    @Override%0A    public void add(ValueBlock values, PositionBlock relevantPositions)%0A    %7B%0A        // TODO: deal with overflow%0A        // TODO: optimize RLE blocks%0A        ValueBlock filtered = values.filter(relevantPositions);%0A%0A        for (Tuple value : filtered) %7B%0A            sum += value.getLong(0);%0A            ++count;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public Tuple evaluate()%0A    %7B%0A        return getTupleInfo().builder()%0A                .append(sum / count)%0A                .build();%0A    %7D%0A%7D%0A

implement simple average aggregation