Skip to content
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

Make sort order consistent in split queries #34097

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ascott18
Copy link

@ascott18 ascott18 commented Jun 26, 2024

Make sort order consistent in split queries between the parent query and its occurrences in subqueries for collection includes.

  • Deterministic sorting was already being added to the parent query (sorting by the identifiers used to join the subquery to the subsequent collection queries). However, due to what appears to be a simple oversight, these were not getting applied to the subquery in the split collection query. As a result, the parent query and the subquery were actively being given different sort orderings.
  • Tests that previously expected a thrown exception (Include_collection_skip_take_no_order_by, Include_collection_skip_no_order_by) due to this missing sort order in skip/take queries have been made non-throwing since the same ordering from the parent query is now applied to the subquery that lacked sorting.

All the changes in the tests that add or change an ORDER BY are such that the change makes the subquery exactly match the parent query.

Since the same deterministic sorting was already being appended to the parent query, I didn't go down the paths discussed in #26808 of checking whether existing sorts on the query are already perfectly deterministic.

Fixes #26808

(Apologies for not asking for permission to work on this first - this started out as an exploration of whether I could even figure out how to approach fixing an issue like this).

…and its occurrences in subqueries for collection includes.

Fixes dotnet#26808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant