Skip to content

Cosmos: handle fake LeftJoins in query tree #33969

Description

@roji

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).

Activity

  1. added this to the 9.0.0 milestone on Jun 12, 2024
  2. self-assigned this
    on Jun 12, 2024
  3. added a commit that references this issue on Jun 22, 2024
    1fc8ad0
  4. removed this from the 9.0.0 milestone on Jun 22, 2024
  5. roji commented on Jun 22, 2024

    @roji
    MemberAuthor

    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).

  6. added 3 commits that reference this issue on Jun 22, 2024
    3977d24
    ace49d3
    e6dedc3
  7. ajcvickers commented on Nov 11, 2024

    @ajcvickers
    Contributor

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

  8. roji commented on Nov 12, 2024

    @roji
    MemberAuthor

    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.

  9. added this to the 9.0.0 milestone on Nov 12, 2024
  10. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions