-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DistinctBy to avoid duplications #10677
Add DistinctBy to avoid duplications #10677
Conversation
Add DistinctBy to avoid duplications
@erikjanwestendorp Thanks for creating a PR to fix the linked issue 👍🏻 Although this does indeed remove the duplications, it doesn't fix the underlying issue when more than 2000 items are in the collection. Umbraco-CMS/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs Lines 1099 to 1105 in b8540ca
This issue is twofold:
I expect the |
Hi there @erikjanwestendorp, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
But thinking about this a little bit more, grouping the items and doing multiple SQL queries could result in missing rows. To illustrate:
So we should ensure one of the WHERE languageId IN (null, 1, 2) AND WHERE nodeId IN (1000, 2000)
WHERE languageId IN (null, 1, 2) AND WHERE nodeId IN (3000) |
@ronaldbarendse Thanks for your review and your feedback. Just updated the PR, would you like to look at this again? 😄.
|
Hi @erikjanwestendorp, I just got around to looking at this again and unfortunately this still has the issue I described in #10677 (comment) (we can't group both language and node IDs at the same time, as that might result in missing results). I've created PR #11369 to introduce a constant for the 'magic' number we use in quite a few places to prevent going over the maximum amount of SQL parameters. It also fixes this and a similar issue when fetching user group permissions, so I'll close this one in favor of that PR. Thanks for the effort you've put into this though! 🤗 |
Add DistinctBy to avoid duplications
Prerequisites
See issue description:
#10383
Description
Add DistinctBy to avoid duplications