-
Notifications
You must be signed in to change notification settings - Fork 470
Left Join issue #4888
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
base: master
Are you sure you want to change the base?
Left Join issue #4888
Conversation
@igor-tkachev, which SQL do you expect from |
It is not a bug, it is a bloody enterprise which already works for at least 10 years. |
@igor-tkachev, translation of How about
var q = db.Parent
.GroupJoin(db.Child, p => p.Value1, c => c.ParentID, (p, g) => new { p, g })
.SelectMany(t => t.g.DefaultIfEmpty(), (t, c) => new { t, c })
.Where(t => t.t.g == null)
.Select(t => t.t.p.ParentID); |
@sdanyliv I can see a value in this type of query. It's basically a left anti-join: give me all items on the left that have no matches on the right. Proper SQL would be: select ParentId
from Parent p
left join Child c
on p.Value1 = c.ParentId
where c.ParentId is null; alternatively: select ParentId
from Parent p
where not exists (
select *
from Child c
where c.ParentId = p.Value1); |
@igor-tkachev An alternative query that would be more explicitly correct that should work: from p in db.Parent
where !db.Child.Any(c => c.ParentID == p.Value1)
select p.ParentID; |
@viceroypenguin, it's not about writing the ideal query, but rather about handling problematic customer queries without needing to rewrite them or at least don't allow to compile. |
@sdanyliv my point is, I don't agree that writing |
Modern compilers will warn about comparing a non-nullable Yes, I can rewrite |
Ah, good point. Then yes, I agree. |
@sdanyliv I understand that this is kind of crazy code. If we write analyzer to show this code, it would be OK. But even if you generate an appropriate exception with explanation, it will be very helpful as well. |
Modified the exception message as follows. To avoid introducing specialized logic during predicate generation, the message is kept general:
|
/azp run test-all |
Azure Pipelines successfully started running 1 pipeline(s). |
The following code is not working:
Worked in 5.4.1.