From 6ba1bab5674800522c70d4a5f482ad07169711e6 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Sun, 15 Dec 2024 15:22:27 +0100 Subject: [PATCH] More fixes --- EFCore.sln.DotSettings | 1 - .../OperatorTranslationsCosmosTest.cs | 6 ++++-- .../Query/GearsOfWarQuerySqlServerTest.cs | 10 ++-------- .../Query/NullSemanticsQuerySqlServerTest.cs | 19 ++----------------- .../Query/TPCGearsOfWarQuerySqlServerTest.cs | 10 ++-------- .../Query/TPTGearsOfWarQuerySqlServerTest.cs | 10 ++-------- .../TemporalGearsOfWarQuerySqlServerTest.cs | 10 ++-------- 7 files changed, 14 insertions(+), 52 deletions(-) diff --git a/EFCore.sln.DotSettings b/EFCore.sln.DotSettings index 16ca4b1b831..e8f3d08f6c0 100644 --- a/EFCore.sln.DotSettings +++ b/EFCore.sln.DotSettings @@ -359,7 +359,6 @@ The .NET Foundation licenses this file to you under the MIT license. True True True - True True True True diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/Translations/OperatorTranslationsCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/Translations/OperatorTranslationsCosmosTest.cs index f2ede0adae0..a3687b401e4 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/Translations/OperatorTranslationsCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/Translations/OperatorTranslationsCosmosTest.cs @@ -19,11 +19,12 @@ public override Task Conditional_simplifiable_equality(bool async) { await base.Conditional_simplifiable_equality(a); + // TODO: Simplify this away, as per #35327 for relational AssertSql( """ SELECT VALUE c FROM root c -WHERE (c["Int"] > 1) +WHERE (((c["Int"] = 9) ? 9 : c["Int"]) > 1) """); }); @@ -33,11 +34,12 @@ public override Task Conditional_simplifiable_inequality(bool async) { await base.Conditional_simplifiable_inequality(a); + // TODO: Simplify this away, as per #35327 for relational AssertSql( """ SELECT VALUE c FROM root c -WHERE (c["Int"] > 1) +WHERE (((c["Int"] != 8) ? c["Int"] : 8) > 1) """); }); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index 2c7af4efde4..508437851dc 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -1979,10 +1979,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE CASE - WHEN [g].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) - ELSE [g].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -1995,10 +1992,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE CASE - WHEN [g].[HasSoulPatch] = CAST(0 AS bit) THEN CAST(0 AS bit) - ELSE [g].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs index d771cc25f85..1de199a3c46 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs @@ -2205,13 +2205,7 @@ public override async Task Where_equal_with_conditional(bool async) """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] - ELSE [e].[NullableStringB] -END = [e].[NullableStringC] OR (CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] - ELSE [e].[NullableStringB] -END IS NULL AND [e].[NullableStringC] IS NULL) +WHERE [e].[NullableStringB] = [e].[NullableStringC] OR ([e].[NullableStringB] IS NULL AND [e].[NullableStringC] IS NULL) """); } @@ -2223,16 +2217,7 @@ public override async Task Where_not_equal_with_conditional(bool async) """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringC] <> CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] - ELSE [e].[NullableStringB] -END OR [e].[NullableStringC] IS NULL OR CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] - ELSE [e].[NullableStringB] -END IS NULL) AND ([e].[NullableStringC] IS NOT NULL OR CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] - ELSE [e].[NullableStringB] -END IS NOT NULL) +WHERE ([e].[NullableStringC] <> [e].[NullableStringB] OR [e].[NullableStringC] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringC] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs index 72bcecad409..18aca22ea4c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs @@ -2739,10 +2739,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId] -WHERE CASE - WHEN [u].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) - ELSE [u].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [u].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -2761,10 +2758,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId] -WHERE CASE - WHEN [u].[HasSoulPatch] = CAST(0 AS bit) THEN CAST(0 AS bit) - ELSE [u].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [u].[HasSoulPatch] = CAST(0 AS bit) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs index f353b8cd00b..070adfd5e7c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs @@ -2361,10 +2361,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] -WHERE CASE - WHEN [s].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) - ELSE [s].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [s].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -2380,10 +2377,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] -WHERE CASE - WHEN [s].[HasSoulPatch] = CAST(0 AS bit) THEN CAST(0 AS bit) - ELSE [s].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [s].[HasSoulPatch] = CAST(0 AS bit) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs index 55d2861f9e2..f1948bf9ea3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs @@ -724,10 +724,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE CASE - WHEN [g].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) - ELSE [g].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -1570,10 +1567,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE CASE - WHEN [g].[HasSoulPatch] = CAST(0 AS bit) THEN CAST(0 AS bit) - ELSE [g].[HasSoulPatch] -END = CAST(0 AS bit) +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) """); }