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

Cosmos: handle fake LeftJoins in query tree #33969

Closed
roji opened this issue Jun 12, 2024 · 3 comments · Fixed by #34066
Closed

Cosmos: handle fake LeftJoins in query tree #33969

roji opened this issue Jun 12, 2024 · 3 comments · Fixed by #34066
Assignees
Labels
area-cosmos area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Jun 12, 2024

Our preprocessing (nav expansion) produces LeftJoin nodes for owned entity collection, such as in the following case:

public virtual Task Filter_owned_entity_chained_with_regular_entity_followed_by_projecting_owned_collection(bool async)
    => AssertQuery(
        async,
        ss => ss.Set<OwnedPerson>().Where(p => p.PersonAddress.Country.Planet.Id != 42).OrderBy(p => p.Id)
            .Select(p => new { p.Orders }),
        assertOrder: true,
        elementAsserter: (e, a) => AssertCollection(e.Orders, a.Orders));

Of course, in Cosmos (and in relational JSON), p.Orders doesn't represent a join at all; so we need to ignore it, reverse-engineering the original query so that this can be translated.

Long-term, we should get rid of these nodes altogether by removing nav expansion as a preprocessing step (#32957).

@roji roji added this to the 9.0.0 milestone Jun 12, 2024
@roji roji self-assigned this Jun 12, 2024
roji added a commit to roji/efcore that referenced this issue Jun 22, 2024
@roji roji added the closed-no-further-action The issue is closed and no further action is planned. label Jun 22, 2024
@roji roji removed this from the 9.0.0 milestone Jun 22, 2024
@roji
Copy link
Member Author

roji commented Jun 22, 2024

These turned out to be non-fake LeftJoins, since a non-owned entity (Planet) is accessed in the query above. Will introduce a specialized translation failure message for this case, and scrub the tests hitting this (see #34066).

@roji roji closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2024
roji added a commit to roji/efcore that referenced this issue Jun 22, 2024
roji added a commit to roji/efcore that referenced this issue Jun 22, 2024
roji added a commit that referenced this issue Jun 24, 2024
@ajcvickers
Copy link
Contributor

@roji Should this be closed-fixed and in a release, or closed-no-further-action and then closed as not-planned?

@ajcvickers ajcvickers reopened this Nov 11, 2024
@roji
Copy link
Member Author

roji commented Nov 12, 2024

Thanks for going over these @ajcvickers. This ended up being an error message tweak and a test cleanup, am placing in the 9.0 milestone as closed-fixed.

@roji roji closed this as completed Nov 12, 2024
@roji roji added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed closed-no-further-action The issue is closed and no further action is planned. labels Nov 12, 2024
@roji roji added this to the 9.0.0 milestone Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-cosmos area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants