feat(api): return coverage suggestions in recipe_id order (#75)
The candidate-recipe query in .query_candidate_recipes() used SELECT
DISTINCT with no ORDER BY, and .build_suggestions() emits suggestions in
candidate order. DuckDB returns DISTINCT rows in whatever order its
parallel hash aggregate finishes, so two identical cog_spending() or
cog_revenue() calls could list the same suggestions in different orders.
The query now ends in ORDER BY recipe_id.
On the bundled fixture, cog_spending("010000226085", 2011, category =
"All Categories") listed corrections_other_capital_combined before
corrections_combined; both new tests fail against the previous code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qbe6u2h83wgZdTgJgE4Xh5
This commit is contained in:
3 files changed
+48
-2
No files matched your search
@@ -1,3 +1,12 @@
|
||||
# uscogdata (development version)
|
||||
|
||||
## Suggestions come back in a stable order
|
||||
|
||||
`cog_spending()` and `cog_revenue()` now order suggestions by `recipe_id`. The query
|
||||
that picks candidate recipes used `SELECT DISTINCT` with no `ORDER BY`, so DuckDB
|
||||
returned them in whatever order its parallel aggregate finished, and two identical
|
||||
calls could list the same suggestions in different orders. The query now sorts them.
|
||||
|
||||
# uscogdata 0.4.0
|
||||
|
||||
## Cohorts can be named by predicate, not just by id
|
||||
|
||||
Reference in new issue
Block a user