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

[6.0-rc2] Adding regression test for #15279 #26081

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3300,6 +3300,31 @@ public virtual Task Complex_query_with_groupBy_in_subquery4(bool async)
});
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Complex_query_with_group_by_in_subquery5(bool async)
{
return AssertQuery(
async,
ss => from od in ss.Set<OrderDetail>()
where od.Order.Customer.CustomerID == "ALFKI"
group od by od.ProductID into grouping
select new
{
Sum = grouping.Sum(x => x.ProductID + x.OrderID * 1000),
Subquery = (from c in ss.Set<Customer>()
where c.CustomerID.Length < grouping.Min(x => x.OrderID / 100)
orderby c.CustomerID
select new { c.CustomerID, c.City }).ToList()
},
elementSorter: e => e.Sum,
elementAsserter: (e, a) =>
{
AssertEqual(e.Sum, a.Sum);
AssertCollection(e.Subquery, a.Subquery, elementSorter: ee => ee.CustomerID);
});
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task GroupBy_scalar_subquery(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2847,6 +2847,33 @@ public override async Task Select_correlated_collection_after_GroupBy_aggregate_
//AssertSql(" ");
}

public override async Task Complex_query_with_group_by_in_subquery5(bool async)
{
await base.Complex_query_with_group_by_in_subquery5(async);

AssertSql(
@"SELECT [t].[c], [t].[ProductID], [t0].[CustomerID], [t0].[City]
FROM (
SELECT COALESCE(SUM([o].[ProductID] + ([o].[OrderID] * 1000)), 0) AS [c], [o].[ProductID]
FROM [Order Details] AS [o]
INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID]
LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID]
WHERE [c].[CustomerID] = N'ALFKI'
GROUP BY [o].[ProductID]
) AS [t]
OUTER APPLY (
SELECT [c0].[CustomerID], [c0].[City]
FROM [Customers] AS [c0]
WHERE CAST(LEN([c0].[CustomerID]) AS int) < (
SELECT MIN([o1].[OrderID] / 100)
FROM [Order Details] AS [o1]
INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID]
LEFT JOIN [Customers] AS [c1] ON [o2].[CustomerID] = [c1].[CustomerID]
WHERE ([c1].[CustomerID] = N'ALFKI') AND ([t].[ProductID] = [o1].[ProductID]))
) AS [t0]
ORDER BY [t].[ProductID], [t0].[CustomerID]");
}

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ public override async Task Select_nested_collection_with_groupby(bool async)
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Select_nested_collection_with_groupby(async))).Message);

public override async Task Complex_query_with_group_by_in_subquery5(bool async)
=> Assert.Equal(
SqliteStrings.ApplyNotSupported,
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Complex_query_with_group_by_in_subquery5(async))).Message);

public override async Task Odata_groupby_empty_key(bool async)
=> await Assert.ThrowsAsync<NotSupportedException>(() => base.Odata_groupby_empty_key(async));
}
Expand Down