@@ -0,0 +1,2900 @@
+/**%0A * END USER LICENSE AGREEMENT (%E2%80%9CEULA%E2%80%9D)%0A *%0A * READ THIS AGREEMENT CAREFULLY (date: 9/13/2011):%0A * http://www.akiban.com/licensing/20110913%0A *%0A * BY INSTALLING OR USING ALL OR ANY PORTION OF THE SOFTWARE, YOU ARE ACCEPTING%0A * ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. YOU AGREE THAT THIS%0A * AGREEMENT IS ENFORCEABLE LIKE ANY WRITTEN AGREEMENT SIGNED BY YOU.%0A *%0A * IF YOU HAVE PAID A LICENSE FEE FOR USE OF THE SOFTWARE AND DO NOT AGREE TO%0A * THESE TERMS, YOU MAY RETURN THE SOFTWARE FOR A FULL REFUND PROVIDED YOU (A) DO%0A * NOT USE THE SOFTWARE AND (B) RETURN THE SOFTWARE WITHIN THIRTY (30) DAYS OF%0A * YOUR INITIAL PURCHASE.%0A *%0A * IF YOU WISH TO USE THE SOFTWARE AS AN EMPLOYEE, CONTRACTOR, OR AGENT OF A%0A * CORPORATION, PARTNERSHIP OR SIMILAR ENTITY, THEN YOU MUST BE AUTHORIZED TO SIGN%0A * FOR AND BIND THE ENTITY IN ORDER TO ACCEPT THE TERMS OF THIS AGREEMENT. THE%0A * LICENSES GRANTED UNDER THIS AGREEMENT ARE EXPRESSLY CONDITIONED UPON ACCEPTANCE%0A * BY SUCH AUTHORIZED PERSONNEL.%0A *%0A * IF YOU HAVE ENTERED INTO A SEPARATE WRITTEN LICENSE AGREEMENT WITH AKIBAN FOR%0A * USE OF THE SOFTWARE, THE TERMS AND CONDITIONS OF SUCH OTHER AGREEMENT SHALL%0A * PREVAIL OVER ANY CONFLICTING TERMS OR CONDITIONS IN THIS AGREEMENT.%0A */%0A%0Apackage com.akiban.server.types3.mcompat.aggr;%0A%0Aimport com.akiban.server.types3.TAggregator;%0Aimport com.akiban.server.types3.TClass;%0Aimport com.akiban.server.types3.TInstance;%0Aimport com.akiban.server.types3.TPreptimeValue;%0Aimport com.akiban.server.types3.mcompat.mtypes.MNumeric;%0Aimport com.akiban.server.types3.pvalue.PUnderlying;%0Aimport com.akiban.server.types3.pvalue.PValue;%0Aimport com.akiban.server.types3.pvalue.PValueSource;%0Aimport com.akiban.server.types3.pvalue.PValueTarget;%0A%0Apublic abstract class MCount implements TAggregator %7B%0A%0A    private static final TAggregator%5B%5D INSTANCES = %7B%0A        // COUNT(*)%0A        new MCount() %7B%0A%0A            @Override%0A            public void input(TInstance instance, PValueSource source) %7B%0A                ++count;%0A            %7D%0A        %7D, %0A        // COUNT%0A        new MCount() %7B%0A%0A            @Override%0A            public void input(TInstance instance, PValueSource source) %7B%0A                if (!source.isNull()) ++count;%0A            %7D%0A        %7D%0A    %7D;%0A    %0A    private static long count;%0A    private static TClass typeClass;%0A    private static final PValueSource EMPTY_VALUE = new PValue(PUnderlying.INT_64);%0A%0A    private MCount() %7B%0A        count = 0;%0A        typeClass = MNumeric.BIGINT;%0A    %7D%0A    %0A    @Override%0A    public void output(TInstance instance, PValueTarget target) %7B%0A        target.putInt64(count);%0A        count = 0;%0A    %7D%0A%0A    @Override%0A    public PValueSource emptyValue() %7B%0A        return EMPTY_VALUE;%0A    %7D%0A%0A    @Override%0A    public TInstance resultType(TPreptimeValue value) %7B%0A        return value.instance();%0A    %7D%0A%0A    @Override%0A    public TClass getTypeClass() %7B%0A        return typeClass;%0A    %7D%0A%7D%0A

add aggregate count function