Bugs we found in DuckDB, ClickHouse, and NumPy aggregate functions
What we're building
We have been developing writePath over the past year focused on providing customers with:
- Sub-millisecond aggregations over the first or last N rows of their data with no pre-computation
- Precise aggregation functions validated against reference implementations and exact math
- A simple AWS Marketplace experience allowing control through APIs
What we found
During development we used reference implementations from vendors and packages such as DuckDB, ClickHouse, and NumPy to validate aggregate correctness.
We found bugs within the reference implementations falling into one of 3 main categories: Rounding, Range, and Logic.
| Category | Reference implementation bug | How writePath addresses it |
|---|---|---|
| Rounding | Digits rounded during accumulation are lost | Values are accumulated exactly and rounded once at the end |
| Range | Numbers exceed type constraints resulting in overflow or wraparound | Integers stay integers and intermediate results never overflow when the true answer fits |
| Logic | The wrong rule is applied for constant data, infinities, zero or negative weights, or empty input | Every edge case has a defined rule that is documented per function and validated against reference implementations and exact math |
How we report bugs
Since these are not security bugs, our approach is to submit each bug to the vendor through proper channels and then post our findings here.
After each submission and post, we will add another entry to the table at the bottom of this post.
About Us
writePath is an AWS Marketplace SaaS for sub-millisecond aggregations over the first or last N rows of your data with no pre-computation. It offers 65 high-precision aggregation functions tested against reference implementations.
All Vendor Bugs
| Vendor | Function | Bug Submission Link | Blog Post | Date |
|---|---|---|---|---|
| DuckDB | favg | duckdb/duckdb#27961 | DuckDB favg returns the wrong average when values differ greatly in magnitude | October 27, 2026 |