**Describe the bug**
The solution worked with numpy UDFs, but still not with C/C++ UDFs in which there is a strange behaviour:

The aggr_group argument contains the data of the first parameter of the variadic aggregate. No other data is passed to the C UDF.
 

**To Reproduce**

Use the following commands:

CREATE OR REPLACE AGGREGATE jit_sum(*)
RETURNS BIGINT
LANGUAGE C {
    // initialize one aggregate per group
    result->initialize(result, aggr_group.count);
    // zero initialize the sums
    memset(result->data, 0, result->count * sizeof(result->null_value));
    // gather the sums for each of the groups
    for(size_t i = 0; i < arg2.count; i++) {
        result->data[aggr_group.data[i]] += input.data[i];
    }
};
CREATE TABLE vals(grp INTEGER, value INTEGER);
INSERT INTO vals VALUES (1, 100), (2, 200), (1, 50), (2, 300);
SELECT grp, jit_sum(value) FROM vals group by grp;


It returns error for arg2.
The following works, which means that parameter 'value' is stored in the aggr_group var. 

CREATE OR REPLACE AGGREGATE jit_sum(*)
RETURNS BIGINT
LANGUAGE C {
    // initialize one aggregate per group
    result->initialize(result, 1);
    // zero initialize the sums
    memset(result->data, 0, result->count * sizeof(result->null_value));
    // gather the sums for each of the groups
    for(size_t i = 0; i < aggr_group.count; i++) {
        result->data[0] += aggr_group.data[i];
    }
};

SELECT grp, jit_sum(value) FROM vals;
Related to bug #7422 (variadic arguments in aggregate UDFs)
This is a GitHub Issue
repo:MonetDB
owner:MonetDB
Title : Related to bug #7422 (variadic arguments in aggregate UDFs)
Issue date:

--- start body ---
**Describe the bug**
The solution worked with numpy UDFs, but still not with C/C++ UDFs in which there is a strange behaviour:

The aggr_group argument contains the data of the first parameter of the variadic aggregate. No other data is passed to the C UDF.
 

**To Reproduce**

Use the following commands:

CREATE OR REPLACE AGGREGATE jit_sum(*)
RETURNS BIGINT
LANGUAGE C {
    // initialize one aggregate per group
    result->initialize(result, aggr_group.count);
    // zero initialize the sums
    memset(result->data, 0, result->count * sizeof(result->null_value));
    // gather the sums for each of the groups
    for(size_t i = 0; i < arg2.count; i++) {
        result->data[aggr_group.data[i]] += input.data[i];
    }
};
CREATE TABLE vals(grp INTEGER, value INTEGER);
INSERT INTO vals VALUES (1, 100), (2, 200), (1, 50), (2, 300);
SELECT grp, jit_sum(value) FROM vals group by grp;


It returns error for arg2.
The following works, which means that parameter 'value' is stored in the aggr_group var. 

CREATE OR REPLACE AGGREGATE jit_sum(*)
RETURNS BIGINT
LANGUAGE C {
    // initialize one aggregate per group
    result->initialize(result, 1);
    // zero initialize the sums
    memset(result->data, 0, result->count * sizeof(result->null_value));
    // gather the sums for each of the groups
    for(size_t i = 0; i < aggr_group.count; i++) {
        result->data[0] += aggr_group.data[i];
    }
};

SELECT grp, jit_sum(value) FROM vals;
--- end body ---
