xinxinzhenhuai commented on issue #77:
URL:
https://github.com/apache/datasketches-postgresql/issues/77#issuecomment-2913495890
Hi team.
I am wondering if the test script has a bug? If so, I could post a patch.
I checked the source code, in test/aod_sketch_test.sql
```
-- lgk = 16
select aod_sketch_get_estimate(aod_sketch_union(sketch, 16)) from
aod_sketch_test;
```
this line is throwing seg fault. I checked the source code, the 2nd
parameter of aod_sketch_union is supposed to be num_values, not lgk?
Here is part of the implementation of `Datum
pg_aod_sketch_union_agg(PG_FUNCTION_ARGS)`
```
if (PG_ARGISNULL(0)) {
stateptr = palloc(sizeof(struct aod_agg_state));
stateptr->type = UNION;
stateptr->num_values = PG_NARGS() > 2 ? PG_GETARG_INT32(2) : 1;
stateptr->lg_k = PG_NARGS() > 3 ? PG_GETARG_INT32(3) : 0;
stateptr->ptr = stateptr->lg_k ? aod_union_new_lgk(stateptr->num_values,
stateptr->lg_k) : aod_union_new(stateptr->num_values);
} else {
stateptr = (struct aod_agg_state*) PG_GETARG_POINTER(0);
}
```
I have updated the script to
```
-- lgk = 16
select aod_sketch_get_estimate(aod_sketch_union(sketch, 1, 16)) from
aod_sketch_test;
```
as the values are ARRAY[1]. Then the test passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]