Skip to content

Commit a7e1639

Browse files
committed
feat: use shared grouped aggregate strategy
1 parent 28b3b48 commit a7e1639

7 files changed

Lines changed: 121 additions & 1628 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
1111

1212
<!-- changelog -->
1313

14+
## Unreleased
15+
16+
### Improvements:
17+
18+
* use the shared `ash_sql` grouped aggregate strategy for aggregate loading, filtering, sorting, calculations, and root query aggregates
19+
* add grouped aggregate regression coverage for list defaults and root query aggregate kinds
20+
1421
## [v0.2.17](https://github.com/ash-project/ash_sqlite/compare/v0.2.16...v0.2.17) (2026-04-22)
1522

1623

documentation/topics/resources/aggregates.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ representatives = Helpdesk.Support.read!(Helpdesk.Support.Representative)
4949
Ash.load!(representatives, [:total_tickets, :ticket_subjects])
5050
```
5151

52+
## Query Aggregates
53+
54+
AshSqlite supports root query aggregates for `count`, `sum`, `avg`, `min`, `max`,
55+
`first`, and `exists`.
56+
57+
```elixir
58+
Helpdesk.Support.Representative
59+
|> Ash.Query.filter(active == true)
60+
|> Ash.aggregate!(count: :count)
61+
```
62+
63+
Relationship query aggregates are not supported by the grouped aggregate query
64+
path. Define a resource aggregate and load, filter, or sort on that aggregate
65+
instead.
66+
5267
## Calculations
5368

5469
Expression calculations can reference aggregates and be pushed down to SQLite.

0 commit comments

Comments
 (0)