@Override
    public void init(String attributeName, Attribute.Type attributeType) {
        Attribute sum;
        Expression sumInitialValue;

        if (attributeName == null) {
            throw new SiddhiAppCreationException("Sum incremental attribute aggregation cannot be executed " +
                    "when no parameters are given");
        }

        if (attributeType.equals(Attribute.Type.FLOAT) || attributeType.equals(Attribute.Type.DOUBLE)) {
            sum = new Attribute("AGG_SUM_".concat(attributeName), Attribute.Type.DOUBLE);
            sumInitialValue = Expression.function("convert", Expression.variable(attributeName),
                    Expression.value("double"));
            returnType = Attribute.Type.DOUBLE;
        } else if (attributeType.equals(Attribute.Type.INT) || attributeType.equals(Attribute.Type.LONG)) {
            sum = new Attribute("AGG_SUM_".concat(attributeName), Attribute.Type.LONG);
            sumInitialValue = Expression.function("convert", Expression.variable(attributeName),
                    Expression.value("long"));
            returnType = Attribute.Type.LONG;
        } else {
            throw new SiddhiAppRuntimeException(
                    "Sum aggregation cannot be executed on attribute type " + attributeType.toString());
        }
        this.baseAttributes = new Attribute[]{sum};
        this.baseAttributesInitialValues = new Expression[]{sumInitialValue}; // Original attribute names
        // used for initial values, since those would be executed using original meta
    }
{@link IncrementalAttributeAggregator} to calculate sum based on an event attribute.
modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java