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

Query: Support for outer apply and multi level binding #16311

Closed
smitpatel opened this issue Jun 27, 2019 · 1 comment · Fixed by #17182
Closed

Query: Support for outer apply and multi level binding #16311

smitpatel opened this issue Jun 27, 2019 · 1 comment · Fixed by #17182
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Member

[ConditionalFact]
        public Task Query_compiler_concurrency()
        {
            const int threadCount = 50;

            var tasks = new Task[threadCount];

            for (var i = 0; i < threadCount; i++)
            {
                tasks[i] = Task.Run(
                    () =>
                    {
                        using (var context = CreateContext())
                        {
                            using ((from c in context.Customers
                                    where c.City == "London"
                                    orderby c.CustomerID
                                    select (from o1 in context.Orders
                                            where o1.CustomerID == c.CustomerID
                                                  && o1.OrderDate.Value.Year == 1997
                                            orderby o1.OrderID
                                            select (from o2 in context.Orders
                                                    where o1.CustomerID == c.CustomerID
                                                    orderby o2.OrderID
                                                    select o1.OrderID)))
                                .GetEnumerator())
                            {
                            }
                        }
                    });
            }

            return Task.WhenAll(tasks);
        }

Ignore concurrency part.
For the query, the inner-most collection references c but it is projecting list of ints. We convert collection of results into left join but since it is referencing outer elements which cannot be removed, we need to apply "outer apply"

@ajcvickers ajcvickers added this to the Backlog milestone Jun 28, 2019
@smitpatel smitpatel modified the milestones: Backlog, 3.0.0 Aug 15, 2019
@smitpatel
Copy link
Member Author

Pulled in 3.0

@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 15, 2019
@smitpatel smitpatel self-assigned this Aug 15, 2019
smitpatel added a commit that referenced this issue Aug 15, 2019
- Validate inner select expression after extracting join predicate that it does not contain reference to outer.
- Also apply same logic for generating collections in projection.
- Identify DefaultIfEmpty in collectionSelector of SelectMany accurately.

This fix up a lot of N+1 evaluation queries.

Resolves #17112
Resolves #16311
smitpatel added a commit that referenced this issue Aug 15, 2019
- Validate inner select expression after extracting join predicate that it does not contain reference to outer.
- Also apply same logic for generating collections in projection.
- Identify DefaultIfEmpty in collectionSelector of SelectMany accurately.

This fix up a lot of N+1 evaluation queries.

Resolves #17112
Resolves #16311
smitpatel added a commit that referenced this issue Aug 15, 2019
- Validate inner select expression after extracting join predicate that it does not contain reference to outer.
- Also apply same logic for generating collections in projection.
- Identify DefaultIfEmpty in collectionSelector of SelectMany accurately.

This fix up a lot of N+1 evaluation queries.

Resolves #17112
Resolves #16311
@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-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants