Repository navigation
Conversation
This was referenced Oct 29, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Compute aggregates of related items - Share one join for aggregates that only differ in their value - Use the comments of the blog in the examples of aggregates - Plan the joins of aggregates with the conditions of the search
Flo0807
force-pushed
the
feature/relationship-aggregates
branch
from
November 13, 2026 09:46
8b36ca3 to
5b9e555
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack (merge in this order)
developAggregates over relationships to many items as computed values, the second part of the
item_queryreplacement. It covers the joins of subqueries of related items, e.g. the number of the posts of a user or the author of the newest comment.Backpex.Expr.aggregate/3Kinds:
:count,:sum,:avg,:min,:maxand:first(after:sort). The path can go through several relationships ([:posts, :tags]), the value through relationships to one item (expr(author.name)). It lives inBackpex.Exprinstead ofBackpex.Queryas in the design: it is an expression, and one function avoids clashes ofcount/min/maxwithKernelonimport Backpex.Expr.DISTINCT ONfor:first), shared by aggregates that only differ in their value (one column per value), so items are never duplicated;:countis 0 without related items. The index view sorts by and searches aggregates.Testing
On 607bbae:
mix test: 1530 passed (189 doctests, 1341 tests), includingintegration_test/options/computed_test.exsagainst PostgreSQL (Backpex.Test.UserStatsLive: count, count with where, sum, first with sort, first overposts.tags, sorting and search)mix test --only e2e: 60 passedmix test.coverageafter both runs with--cover: 90.32 %MIX_ENV=test mix lint: clean,mix docs --warnings-as-errorsandmix sobelow --configcleanbun run test51 passed,bun run test:playwright38 passedOn 8c5cce5 (shared joins, merged values of #2454; f392b8e only changes docs):
mix test: 1547 passed (190 doctests, 1357 tests)mix test --only e2e: 60 passedMIX_ENV=test mix lint: clean,mix docs --warnings-as-errorsandmix sobelow --configclean