From e0e91fd777f58ccfdd2a3dae36dd2f48ffbd033a Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Mon, 23 Dec 2024 22:43:56 +0100 Subject: [PATCH] Update baselines --- .../ManyToManyNoTrackingQuerySqlServerTest.cs | 12 +-- .../Query/ManyToManyQuerySqlServerTest.cs | 12 +-- .../NorthwindSelectQuerySqlServerTest.cs | 98 +++++++------------ ...CManyToManyNoTrackingQuerySqlServerTest.cs | 12 +-- .../Query/TPCManyToManyQuerySqlServerTest.cs | 12 +-- ...TManyToManyNoTrackingQuerySqlServerTest.cs | 12 +-- .../Query/TPTManyToManyQuerySqlServerTest.cs | 12 +-- .../TemporalManyToManyQuerySqlServerTest.cs | 12 +-- 8 files changed, 70 insertions(+), 112 deletions(-) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs index 386c1fe322a..bae3e0c8d57 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs @@ -300,17 +300,15 @@ public override async Task Skip_navigation_order_by_single_or_default(bool async """ SELECT [s0].[Id], [s0].[Name] FROM [EntityOnes] AS [e] -OUTER APPLY ( - SELECT TOP(1) [s].[Id], [s].[Name] +LEFT JOIN ( + SELECT [s].[Id], [s].[Name], [s].[LeftId] FROM ( - SELECT TOP(1) [e0].[Id], [e0].[Name] + SELECT [e0].[Id], [e0].[Name], [j].[LeftId], ROW_NUMBER() OVER(PARTITION BY [j].[LeftId] ORDER BY [e0].[Id]) AS [row] FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[RightId] = [e0].[Id] - WHERE [e].[Id] = [j].[LeftId] - ORDER BY [e0].[Id] ) AS [s] - ORDER BY [s].[Id] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [e].[Id] = [s0].[LeftId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs index 222bfd862ef..05e481e565a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs @@ -299,17 +299,15 @@ public override async Task Skip_navigation_order_by_single_or_default(bool async """ SELECT [s0].[Id], [s0].[Name] FROM [EntityOnes] AS [e] -OUTER APPLY ( - SELECT TOP(1) [s].[Id], [s].[Name] +LEFT JOIN ( + SELECT [s].[Id], [s].[Name], [s].[LeftId] FROM ( - SELECT TOP(1) [e0].[Id], [e0].[Name] + SELECT [e0].[Id], [e0].[Name], [j].[LeftId], ROW_NUMBER() OVER(PARTITION BY [j].[LeftId] ORDER BY [e0].[Id]) AS [row] FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[RightId] = [e0].[Id] - WHERE [e].[Id] = [j].[LeftId] - ORDER BY [e0].[Id] ) AS [s] - ORDER BY [s].[Id] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [e].[Id] = [s0].[LeftId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs index c3cea875063..352257d8e0b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs @@ -760,14 +760,10 @@ public override async Task Project_single_element_from_collection_with_OrderBy_T AssertSql( """ SELECT ( - SELECT TOP(1) [o0].[CustomerID] - FROM ( - SELECT TOP(1) [o].[CustomerID], [o].[OrderID] - FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderID] - ) AS [o0] - ORDER BY [o0].[OrderID]) + SELECT TOP(1) [o].[CustomerID] + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] + ORDER BY [o].[OrderID]) FROM [Customers] AS [c] """); } @@ -828,14 +824,10 @@ public override async Task Project_single_element_from_collection_with_OrderBy_T AssertSql( """ SELECT ( - SELECT TOP(1) [o0].[CustomerID] - FROM ( - SELECT TOP(1) [o].[CustomerID], [o].[OrderID] - FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderID] - ) AS [o0] - ORDER BY [o0].[OrderID]) + SELECT TOP(1) [o].[CustomerID] + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] + ORDER BY [o].[OrderID]) FROM [Customers] AS [c] WHERE [c].[CustomerID] = N'ALFKI' """); @@ -869,14 +861,10 @@ public override async Task Project_single_element_from_collection_with_multiple_ AssertSql( """ SELECT ( - SELECT TOP(1) [o0].[CustomerID] - FROM ( - SELECT TOP(2) [o].[CustomerID], [o].[OrderID], [o].[OrderDate] - FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderID], [o].[OrderDate] DESC - ) AS [o0] - ORDER BY [o0].[OrderID], [o0].[OrderDate] DESC) + SELECT TOP(1) [o].[CustomerID] + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] + ORDER BY [o].[OrderID], [o].[OrderDate] DESC) FROM [Customers] AS [c] """); } @@ -892,14 +880,10 @@ await base AssertSql( """ SELECT ( - SELECT TOP(1) [o0].[c] - FROM ( - SELECT TOP(2) CAST(LEN([o].[CustomerID]) AS int) AS [c], [o].[OrderID], [o].[OrderDate] - FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderID], [o].[OrderDate] DESC - ) AS [o0] - ORDER BY [o0].[OrderID], [o0].[OrderDate] DESC) + SELECT TOP(1) CAST(LEN([o].[CustomerID]) AS int) + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] + ORDER BY [o].[OrderID], [o].[OrderDate] DESC) FROM [Customers] AS [c] """); } @@ -911,14 +895,10 @@ public override async Task Project_single_element_from_collection_with_multiple_ AssertSql( """ SELECT ( - SELECT TOP(1) [o0].[CustomerID] - FROM ( - SELECT TOP(2) [o].[CustomerID], [o].[OrderDate] - FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[CustomerID], [o].[OrderDate] DESC - ) AS [o0] - ORDER BY [o0].[CustomerID], [o0].[OrderDate] DESC) + SELECT TOP(1) [o].[CustomerID] + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] + ORDER BY [o].[CustomerID], [o].[OrderDate] DESC) FROM [Customers] AS [c] """); } @@ -930,15 +910,11 @@ public override async Task Project_single_element_from_collection_with_OrderBy_o AssertSql( """ SELECT COALESCE(( - SELECT TOP(1) [s].[OrderID] - FROM ( - SELECT TOP(1) [o0].[OrderID], [p].[ProductName] - FROM [Order Details] AS [o0] - INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] - WHERE [o].[OrderID] = [o0].[OrderID] - ORDER BY [p].[ProductName] - ) AS [s] - ORDER BY [s].[ProductName]), 0) + SELECT TOP(1) [o0].[OrderID] + FROM [Order Details] AS [o0] + INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] + WHERE [o].[OrderID] = [o0].[OrderID] + ORDER BY [p].[ProductName]), 0) FROM [Orders] AS [o] WHERE [o].[OrderID] < 10300 """); @@ -953,17 +929,15 @@ public override async Task Project_single_element_from_collection_with_OrderBy_o """ SELECT [s0].[OrderID], [s0].[ProductID], [s0].[Discount], [s0].[Quantity], [s0].[UnitPrice] FROM [Orders] AS [o] -OUTER APPLY ( - SELECT TOP(1) [s].[OrderID], [s].[ProductID], [s].[Discount], [s].[Quantity], [s].[UnitPrice] +LEFT JOIN ( + SELECT [s].[OrderID], [s].[ProductID], [s].[Discount], [s].[Quantity], [s].[UnitPrice] FROM ( - SELECT TOP(1) [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [p].[ProductName] + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], ROW_NUMBER() OVER(PARTITION BY [o0].[OrderID] ORDER BY [p].[ProductName]) AS [row] FROM [Order Details] AS [o0] INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] - WHERE [o].[OrderID] = [o0].[OrderID] - ORDER BY [p].[ProductName] ) AS [s] - ORDER BY [s].[ProductName] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [o].[OrderID] = [s0].[OrderID] WHERE [o].[OrderID] < 10250 """); } @@ -1344,16 +1318,14 @@ public override async Task SelectMany_with_multiple_Take(bool async) """ SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate] FROM [Customers] AS [c] -CROSS APPLY ( - SELECT TOP(3) [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] +INNER JOIN ( + SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM ( - SELECT TOP(5) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] + SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o].[CustomerID] ORDER BY [o].[OrderID]) AS [row] FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderID] ) AS [o0] - ORDER BY [o0].[OrderID] -) AS [o1] + WHERE [o0].[row] <= 3 +) AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs index 5ec6900fde0..c8d247745c4 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs @@ -328,17 +328,15 @@ public override async Task Skip_navigation_order_by_single_or_default(bool async """ SELECT [s0].[Id], [s0].[Name] FROM [EntityOnes] AS [e] -OUTER APPLY ( - SELECT TOP(1) [s].[Id], [s].[Name] +LEFT JOIN ( + SELECT [s].[Id], [s].[Name], [s].[LeftId] FROM ( - SELECT TOP(1) [e0].[Id], [e0].[Name] + SELECT [e0].[Id], [e0].[Name], [j].[LeftId], ROW_NUMBER() OVER(PARTITION BY [j].[LeftId] ORDER BY [e0].[Id]) AS [row] FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[RightId] = [e0].[Id] - WHERE [e].[Id] = [j].[LeftId] - ORDER BY [e0].[Id] ) AS [s] - ORDER BY [s].[Id] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [e].[Id] = [s0].[LeftId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs index 10a704eec28..523e4341106 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs @@ -328,17 +328,15 @@ public override async Task Skip_navigation_order_by_single_or_default(bool async """ SELECT [s0].[Id], [s0].[Name] FROM [EntityOnes] AS [e] -OUTER APPLY ( - SELECT TOP(1) [s].[Id], [s].[Name] +LEFT JOIN ( + SELECT [s].[Id], [s].[Name], [s].[LeftId] FROM ( - SELECT TOP(1) [e0].[Id], [e0].[Name] + SELECT [e0].[Id], [e0].[Name], [j].[LeftId], ROW_NUMBER() OVER(PARTITION BY [j].[LeftId] ORDER BY [e0].[Id]) AS [row] FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[RightId] = [e0].[Id] - WHERE [e].[Id] = [j].[LeftId] - ORDER BY [e0].[Id] ) AS [s] - ORDER BY [s].[Id] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [e].[Id] = [s0].[LeftId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs index bc17e65bd09..639f906257c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs @@ -308,17 +308,15 @@ public override async Task Skip_navigation_order_by_single_or_default(bool async """ SELECT [s0].[Id], [s0].[Name] FROM [EntityOnes] AS [e] -OUTER APPLY ( - SELECT TOP(1) [s].[Id], [s].[Name] +LEFT JOIN ( + SELECT [s].[Id], [s].[Name], [s].[LeftId] FROM ( - SELECT TOP(1) [e0].[Id], [e0].[Name] + SELECT [e0].[Id], [e0].[Name], [j].[LeftId], ROW_NUMBER() OVER(PARTITION BY [j].[LeftId] ORDER BY [e0].[Id]) AS [row] FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[RightId] = [e0].[Id] - WHERE [e].[Id] = [j].[LeftId] - ORDER BY [e0].[Id] ) AS [s] - ORDER BY [s].[Id] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [e].[Id] = [s0].[LeftId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs index 125860a2071..4162cf08b94 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs @@ -307,17 +307,15 @@ public override async Task Skip_navigation_order_by_single_or_default(bool async """ SELECT [s0].[Id], [s0].[Name] FROM [EntityOnes] AS [e] -OUTER APPLY ( - SELECT TOP(1) [s].[Id], [s].[Name] +LEFT JOIN ( + SELECT [s].[Id], [s].[Name], [s].[LeftId] FROM ( - SELECT TOP(1) [e0].[Id], [e0].[Name] + SELECT [e0].[Id], [e0].[Name], [j].[LeftId], ROW_NUMBER() OVER(PARTITION BY [j].[LeftId] ORDER BY [e0].[Id]) AS [row] FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[RightId] = [e0].[Id] - WHERE [e].[Id] = [j].[LeftId] - ORDER BY [e0].[Id] ) AS [s] - ORDER BY [s].[Id] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [e].[Id] = [s0].[LeftId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs index a2d2ce977bc..a63c8b707c0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs @@ -333,17 +333,15 @@ public override async Task Skip_navigation_order_by_single_or_default(bool async """ SELECT [s0].[Id], [s0].[Name], [s0].[PeriodEnd], [s0].[PeriodStart] FROM [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e] -OUTER APPLY ( - SELECT TOP(1) [s].[Id], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart] +LEFT JOIN ( + SELECT [s].[Id], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart], [s].[LeftId] FROM ( - SELECT TOP(1) [e0].[Id], [e0].[Name], [e0].[PeriodEnd], [e0].[PeriodStart] + SELECT [e0].[Id], [e0].[Name], [e0].[PeriodEnd], [e0].[PeriodStart], [j].[LeftId], ROW_NUMBER() OVER(PARTITION BY [j].[LeftId] ORDER BY [e0].[Id]) AS [row] FROM [JoinOneSelfPayload] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[RightId] = [e0].[Id] - WHERE [e].[Id] = [j].[LeftId] - ORDER BY [e0].[Id] ) AS [s] - ORDER BY [s].[Id] -) AS [s0] + WHERE [s].[row] <= 1 +) AS [s0] ON [e].[Id] = [s0].[LeftId] """); }