Skip to content

Conversation

@kounelisagis
Copy link
Member

@kounelisagis kounelisagis commented Sep 18, 2025

This PR fixes overflow issues in sum aggregations by upcasting results to wider types (int8/int16/int32int64, uint8/uint16/uint32uint64, floatdouble). The results are returned correctly by the Core APIs, but at the pybind11 layer of TileDB-Py they were being cast to types that could not hold them. This PR also adds corner-case tests with extreme values to prevent regressions and ensure mathematically correct results.

Closes CORE-376

return py::cast(*((float*)agg_buf));
case TILEDB_FLOAT64:
return py::cast(*((double*)agg_buf));
case TILEDB_INT8:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the research I did, I have every reason to believe that this is the cause of the random segmentation faults we sometimes encounter during our daily test runs. For sum operations, the sum aggregation should return specific upcasted types source

@kounelisagis kounelisagis merged commit feb8cef into main Sep 18, 2025
43 checks passed
@kounelisagis kounelisagis deleted the agis/upcast-sum-aggregation-overflow branch September 18, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants