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

Queryable methods translation progress #15711

Closed
67 tasks done
smitpatel opened this issue May 14, 2019 · 6 comments · Fixed by #17077
Closed
67 tasks done

Queryable methods translation progress #15711

smitpatel opened this issue May 14, 2019 · 6 comments · Fixed by #17077
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@smitpatel
Copy link
Member

smitpatel commented May 14, 2019

Relational:

InMemory:

Cosmos:

Unknowns:
- [ ] Aggregate (Not Needed)

@ajcvickers
Copy link
Member

@roji @smitpatel Should this be updated for set operations?

@roji
Copy link
Member

roji commented Jun 28, 2019

I think we're still waiting in progress - PR #16249 is still outstanding, and even after that we'd ideally complete #16298 (set operations over different entity types).

smitpatel added a commit that referenced this issue Jun 28, 2019
Bugs fixed
- Allow ToList on collection projection to be called with less derived type
- Project out necessary identifiers for collection join when pushing down. (Except distinct case)
- Lift ordering from inner collection to generated ordered result (This would be improved further by #16226)
- Map Cast from Enumerable to Queryable
- Translate AsQueryable as no-op

Resolves #12098
Resolves #15043
Resolves #15611
Part of #15711
smitpatel added a commit that referenced this issue Jun 28, 2019
Bugs fixed
- Allow ToList on collection projection to be called with less derived type
- Project out necessary identifiers for collection join when pushing down. (Except distinct case)
- Lift ordering from inner collection to generated ordered result (This would be improved further by #16226)
- Map Cast from Enumerable to Queryable
- Translate AsQueryable as no-op

Resolves #12098
Resolves #15043
Resolves #15611
Part of #15711
@ajcvickers ajcvickers modified the milestones: 3.0.0, Epics Jun 28, 2019
smitpatel added a commit that referenced this issue Jun 28, 2019
Bugs fixed
- Allow ToList on collection projection to be called with less derived type
- Project out necessary identifiers for collection join when pushing down. (Except distinct case)
- Lift ordering from inner collection to generated ordered result (This would be improved further by #16226)
- Map Cast from Enumerable to Queryable
- Translate AsQueryable as no-op

Resolves #12098
Resolves #15043
Resolves #15611
Part of #15711
smitpatel added a commit that referenced this issue Jul 2, 2019
…fter GroupBy

Resolves #12826
Resolves #6658
Part of #15711
Resolves #15853
Resolves #12799
Resolves #12476
Resolves #11976

There are way too many existing issues are resolved by this PR. I haven't added regression test or verified each of them so I have put Verify-Fixed label on them for now.
smitpatel added a commit that referenced this issue Jul 2, 2019
…fter GroupBy

Resolves #12826
Resolves #6658
Part of #15711
Resolves #15853
Resolves #12799
Resolves #12476
Resolves #11976

There are way too many existing issues are resolved by this PR. I haven't added regression test or verified each of them so I have put Verify-Fixed label on them for now.
smitpatel added a commit that referenced this issue Jul 2, 2019
…fter GroupBy

Resolves #12826
Resolves #6658
Part of #15711
Resolves #15853
Resolves #12799
Resolves #12476
Resolves #11976

There are way too many existing issues are resolved by this PR. I haven't added regression test or verified each of them so I have put Verify-Fixed label on them for now.
smitpatel added a commit that referenced this issue Jul 2, 2019
…fter GroupBy

Resolves #12826
Resolves #6658
Part of #15711
Resolves #15853
Resolves #12799
Resolves #12476
Resolves #11976

There are way too many existing issues are resolved by this PR. I haven't added regression test or verified each of them so I have put Verify-Fixed label on them for now.
@daiplusplus
Copy link

It's not included in the list above, but it seems Include( x => x.Property ) doesn't currently work in InMemoryDatabase either, as reported in #16106

@roji
Copy link
Member

roji commented Jul 5, 2019

@Jehoel as the preview6 announcement explained, InMemory is temporary not working as we're working to get the entire query pipeline working well.

@roji
Copy link
Member

roji commented Jul 5, 2019

Have checked off the set operations - we've probably done what we intend to support for 3.0,

@smitpatel smitpatel added this to the 3.0.0 milestone Aug 10, 2019
@smitpatel
Copy link
Member Author

Moved this Epic to 3.0, submitting PR to wrap up work here.

smitpatel added a commit that referenced this issue Aug 10, 2019
SelectMany in linq look something like following (second clause is considered the collection selector)
```C#
from c in cs
from o in c.Orders
select....
```
Following are the translations of SelectMany

Unrelated collection selector
```C#
from c in cs
from o in os
```
Generates CROSS JOIN

Correlated collection selector with correlation being a predicate
```C#
from c in cs
from o in os.Where(o => o.CustomerID == c.CustomerID)
```
Such predicate can be lifted and used in generating a join. So this query generates JOIN.
If collection selector ends with DefaultIfEmpty then it is LEFT JOIN.

Correlated collection selector with correlation not a predicate
```C#
from c in cs
from o in os.Select(o => c.City)
```
Since we cannot generate a join predicate here, this translates to CROSS APPLY.
If collection selector ends with DefaultIfEmpty then it is OUTER APPLY.

Add support for Cross Apply
Add Support for Outer Apply
Convert Cross Apply to Inner Join when possible
Convert Outer Apply to Left Join when possible
Add translation for DefaultIfEmpty
Add translation for both overloads of SelectMany
Handle DefaultIfEmpty & SelectMany without collectionSelector in Navigation Expansion
Ensure columns are in projection when generating join predicate from a correlated subquery

Currently there are no tests for Cross/Outer Apply.
Our earlier Cross Apply got converted to join. N+1 evaluation tests are disabled right now, which would generate Cross Apply.
We never supported Outer Apply in past.

Resolves #15711
Resolves #12567
Resolves #12572
Resolves #12872
Resolves #16330
Resolves #15081
Resolves #16989

Re-enable tests for #12449
smitpatel added a commit that referenced this issue Aug 10, 2019
SelectMany in linq look something like following (second clause is considered the collection selector)
```C#
from c in cs
from o in c.Orders
select....
```
Following are the translations of SelectMany

Unrelated collection selector
```C#
from c in cs
from o in os
```
Generates CROSS JOIN

Correlated collection selector with correlation being a predicate
```C#
from c in cs
from o in os.Where(o => o.CustomerID == c.CustomerID)
```
Such predicate can be lifted and used in generating a join. So this query generates JOIN.
If collection selector ends with DefaultIfEmpty then it is LEFT JOIN.

Correlated collection selector with correlation not a predicate
```C#
from c in cs
from o in os.Select(o => c.City)
```
Since we cannot generate a join predicate here, this translates to CROSS APPLY.
If collection selector ends with DefaultIfEmpty then it is OUTER APPLY.

- Add support for Cross Apply
- Add Support for Outer Apply
- Convert Cross Apply to Inner Join when possible
- Convert Outer Apply to Left Join when possible
- Add translation for DefaultIfEmpty
- Add translation for both overloads of SelectMany
- Handle DefaultIfEmpty & SelectMany without collectionSelector in Navigation Expansion
- Ensure columns are in projection when generating join predicate from a correlated subquery

Currently there are no tests for Cross/Outer Apply.
Our earlier Cross Apply got converted to join. N+1 evaluation tests are disabled right now, which would generate Cross Apply.
We never supported Outer Apply in past.

Resolves #15711
Resolves #12567
Resolves #12572
Resolves #12872
Resolves #16330
Resolves #15081
Resolves #16989

Re-enable tests for #12449
smitpatel added a commit that referenced this issue Aug 12, 2019
SelectMany in linq look something like following (second clause is considered the collection selector)
```C#
from c in cs
from o in c.Orders
select....
```
Following are the translations of SelectMany

Unrelated collection selector
```C#
from c in cs
from o in os
```
Generates CROSS JOIN

Correlated collection selector with correlation being a predicate
```C#
from c in cs
from o in os.Where(o => o.CustomerID == c.CustomerID)
```
Such predicate can be lifted and used in generating a join. So this query generates JOIN.
If collection selector ends with DefaultIfEmpty then it is LEFT JOIN.

Correlated collection selector with correlation not a predicate
```C#
from c in cs
from o in os.Select(o => c.City)
```
Since we cannot generate a join predicate here, this translates to CROSS APPLY.
If collection selector ends with DefaultIfEmpty then it is OUTER APPLY.

- Add support for Cross Apply
- Add Support for Outer Apply
- Convert Cross Apply to Inner Join when possible
- Convert Outer Apply to Left Join when possible
- Add translation for DefaultIfEmpty
- Add translation for both overloads of SelectMany
- Handle DefaultIfEmpty & SelectMany without collectionSelector in Navigation Expansion
- Ensure columns are in projection when generating join predicate from a correlated subquery

Currently there are no tests for Cross/Outer Apply.
Our earlier Cross Apply got converted to join. N+1 evaluation tests are disabled right now, which would generate Cross Apply.
We never supported Outer Apply in past.

Resolves #15711
Resolves #12567
Resolves #12572
Resolves #12872
Resolves #16330
Resolves #15081
Resolves #16989

Re-enable tests for #12449
smitpatel added a commit that referenced this issue Aug 13, 2019
SelectMany in linq look something like following (second clause is considered the collection selector)
```C#
from c in cs
from o in c.Orders
select....
```
Following are the translations of SelectMany

Unrelated collection selector
```C#
from c in cs
from o in os
```
Generates CROSS JOIN

Correlated collection selector with correlation being a predicate
```C#
from c in cs
from o in os.Where(o => o.CustomerID == c.CustomerID)
```
Such predicate can be lifted and used in generating a join. So this query generates JOIN.
If collection selector ends with DefaultIfEmpty then it is LEFT JOIN.

Correlated collection selector with correlation not a predicate
```C#
from c in cs
from o in os.Select(o => c.City)
```
Since we cannot generate a join predicate here, this translates to CROSS APPLY.
If collection selector ends with DefaultIfEmpty then it is OUTER APPLY.

- Add support for Cross Apply
- Add Support for Outer Apply
- Convert Cross Apply to Inner Join when possible
- Convert Outer Apply to Left Join when possible
- Add translation for DefaultIfEmpty
- Add translation for both overloads of SelectMany
- Handle DefaultIfEmpty & SelectMany without collectionSelector in Navigation Expansion
- Ensure columns are in projection when generating join predicate from a correlated subquery

Currently there are no tests for Cross/Outer Apply.
Our earlier Cross Apply got converted to join. N+1 evaluation tests are disabled right now, which would generate Cross Apply.
We never supported Outer Apply in past.

Resolves #15711
Resolves #12567
Resolves #12572
Resolves #12872
Resolves #16330
Resolves #15081
Resolves #16989

Re-enable tests for #12449
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview9 Aug 21, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview9, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants