class ACountAll extends BuiltInAggregate {

    public ACountAll(int type, Expression on, Select select, boolean distinct) {
        super(type, on, select, distinct);
        // 在Parser.readAggregate那里确保使用COUNT_ALL时distinct是false
        if (distinct) {
            throw DbException.getInternalError();
        }
    }

    @Override
    public Expression optimize(ServerSession session) {<FILL_FUNCTION_BODY>}

    @Override
    protected AggregateData createAggregateData() {
        return new AggregateDataCountAll();
    }

    @Override
    public String getSQL() {
        return "COUNT(*)";
    }

    public class AggregateDataCountAll extends AggregateData {

        private long count;

        public long getCount() {
            return count;
        }

        public void setCount(long count) {
            this.count = count;
        }

        public Select getSelect() {
            return select;
        }

        @Override
        public void add(ServerSession session, Value v) {
            count++;
        }

        @Override
        Value getValue(ServerSession session) {
            return ValueLong.get(count);
        }
    }
}

        super.optimize(session);
        dataType = Value.LONG;
        scale = 0;
        precision = ValueLong.PRECISION;
        displaySize = ValueLong.DISPLAY_SIZE;
        return this;
    
<methods>public void <init>(int, com.lealone.sql.expression.Expression, com.lealone.sql.query.Select, boolean) ,public R accept(ExpressionVisitor<R>) ,public int getAType() ,public com.lealone.sql.expression.aggregate.AggregateData getAggregateData() ,public int getCost() ,public int getDisplaySize() ,public com.lealone.sql.expression.Expression getOn() ,public long getPrecision() ,public int getScale() ,public com.lealone.db.value.Value getValue(com.lealone.db.session.ServerSession) ,public boolean isOptimizable(com.lealone.db.table.Table) ,public com.lealone.sql.expression.Expression optimize(com.lealone.db.session.ServerSession) ,public void updateAggregate(com.lealone.db.session.ServerSession) <variables>protected int displaySize,protected final non-sealed boolean distinct,protected com.lealone.sql.expression.Expression on,protected long precision,protected int scale,protected final non-sealed int type