Skip to content

Add more left join support #2737

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

Merged
merged 7 commits into from
Apr 28, 2022
Merged

Conversation

gliljas
Copy link
Member

@gliljas gliljas commented Apr 22, 2021

Fixes #2672

LINQ LeftJoin only works if the outer reference is projected in the query result, but it's perfectly feasible to only use it in e.g a where clause.

The new visitor could be merged a bit with the old one, in order to allocate a bit less, but I wanted to keep the old one as is for now, since it's used elsewhere. Perhaps the aggregated group joins should be investigated too.

I added two other failing test cases as well, marked with KnownBug. One which doesn't use the outer reference at all. Not a very likely query, since the join becomes irrelevant, but in query generation scenarios it could happen. I guess a visitor which purges the query model from unused left joins could do the trick.

The other test case runs a nested join. I think that could be rewritten to chain the nested joins, instead of nesting them.

Unfortunately, I wasn't able to run the async generator. "Failure scanning NAnt.NUnit2Tasks.dll for extensions"

@fredericDelaporte
Copy link
Member

Unfortunately, I wasn't able to run the async generator. "Failure scanning NAnt.NUnit2Tasks.dll for extensions"

On master branch, this happens if you have kept somewhere a global.json file downgrading the .Net Core SDK.
Since this file is required when generating on 5.3.x branches, I just rename it when I am generating on master branch.

@gliljas
Copy link
Member Author

gliljas commented May 2, 2021

Aha, thanks!

@maca88
Copy link
Contributor

maca88 commented May 26, 2021

The new visitor could be merged a bit with the old one

I updated the new visitor to use an instance of the old one to reduce the allocation.

I added two other failing test cases as well, marked with KnownBug. One which doesn't use the outer reference at all

I added a fix for the one that doesn't use the outer reference anywhere as it wasn't that complicated.

@gliljas
Copy link
Member Author

gliljas commented May 26, 2021

Thanks, @maca88 !

maca88
maca88 previously approved these changes May 30, 2021
@burhanugur
Copy link

Hi @fredericDelaporte @bahusoid ,

I have the same problem with #2672 . This pull request says it has resolved the issue. When do you plan to merge this request?

@fredericDelaporte
Copy link
Member

For some unknown reason, GitHub seems to have difficulties getting the TeamCity builds statuses. Checking manually on https://teamcity.jetbrains.com/, they have all succeeded for this PR. So, I consider forcing the merge for this PR.

@0zancan

This comment was marked as resolved.

@bahusoid

This comment was marked as resolved.

@0zancan

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unused Left Join in LINQ throws exception Linq query failure with left joins
6 participants