@Override
    public void init(String attributeName, Attribute.Type attributeType) {

        if (attributeName != null) {
            LOG.warn("Aggregation count function will return the count of all events and count(" + attributeName +
                    ") will be considered as count().");
        }

        Attribute count;
        Expression countInitialValue;

        // Since we set the initial value of count, we can simply set it as long
        // However, since count is summed internally (in avg incremental calculation),
        // ensure that either double or long is used here (since return value of sum is long or
        // double. Long is chosen here)
        count = new Attribute("AGG_COUNT", Attribute.Type.LONG);
        countInitialValue = Expression.value(1L);

        this.baseAttributes = new Attribute[]{count};
        this.baseAttributesInitialValues = new Expression[]{countInitialValue};
    }
{@link IncrementalAttributeAggregator} to calculate count based on an event attribute.
modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/CountIncrementalAttributeAggregator.java