Skip to content

Commit

Permalink
Fix to #26353 - Test Subquery_with_Distinct_Skip_FirstOrDefault_witho…
Browse files Browse the repository at this point in the history
…ut_OrderBy is non-deterministic (#26363)

added way to order on the client on the top level but don't actually verify the subquery result, because its not deterministic.

Fixes #26353
  • Loading branch information
maumar authored Oct 15, 2021
1 parent 33955bf commit bb46c5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2772,9 +2772,15 @@ public virtual Task Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(b
async,
ss => from l1 in ss.Set<Level1>()
where l1.Id < 3
select (from l3 in ss.Set<Level3>()
orderby l3.Id
select l3).Distinct().Skip(1).FirstOrDefault().Name);
select new
{
Key = l1.Id,
Subquery = (from l3 in ss.Set<Level3>()
orderby l3.Id
select l3).Distinct().Skip(1).FirstOrDefault().Name
},
elementSorter: e => e.Key,
elementAsserter: (e, a) => Assert.Equal(e.Key, a.Key));
}

[ConditionalTheory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2526,14 +2526,14 @@ public override async Task Subquery_with_Distinct_Skip_FirstOrDefault_without_Or
await base.Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(async);

AssertSql(
@"SELECT (
@"SELECT [l].[Id] AS [Key], (
SELECT [t].[Name]
FROM (
SELECT DISTINCT [l0].[Id], [l0].[Level2_Optional_Id], [l0].[Level2_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse3Id], [l0].[OneToMany_Optional_Self_Inverse3Id], [l0].[OneToMany_Required_Inverse3Id], [l0].[OneToMany_Required_Self_Inverse3Id], [l0].[OneToOne_Optional_PK_Inverse3Id], [l0].[OneToOne_Optional_Self3Id]
FROM [LevelThree] AS [l0]
) AS [t]
ORDER BY (SELECT 1)
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY)
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) AS [Subquery]
FROM [LevelOne] AS [l]
WHERE [l].[Id] < 3");
}
Expand Down

0 comments on commit bb46c5e

Please sign in to comment.