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

[automated] Merge branch 'release/9.0' => 'main' #35577

Merged
merged 21 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8943288
Merge commit 'c12cf80baa31de4728c26ac536d75fc728de3b65'
Nov 5, 2024
6449ac2
Merge commit 'e63ad4a76d2949d6f775da1dcafc736065c036ef'
Nov 11, 2024
df84042
Merge commit 'b111d2a29afbfb7b15111ec510a0ac9212560869'
Nov 12, 2024
1019637
Merged PR 44727: [internal/release/8.0] Update dependencies from dnce…
Dec 4, 2024
4185501
[release/9.0-staging] Fix to #35393 - GroupJoin in EF Core 9 Returns …
maumar Jan 14, 2025
ce7ae06
Merge commit '10196376f4843cbbf180ec6ab2ce7d34ceec2fab' into internal…
vseanreesermsft Jan 14, 2025
da24700
Merging internal commits for release/8.0 (#35473)
AndriySvyryd Jan 14, 2025
f8051b1
Update dependencies from https://github.com/dotnet/arcade build 20250…
dotnet-maestro[bot] Jan 15, 2025
9e3cdc2
Update dependencies from https://github.com/dotnet/arcade build 20250…
dotnet-maestro[bot] Jan 20, 2025
cf4d9b5
Merge branch 'release/9.0' into merge/release/8.0-to-release/9.0
AndriySvyryd Jan 28, 2025
59c01a5
Merge branch 'release/9.0' into 'release/9.0-staging' (#35542)
AndriySvyryd Jan 28, 2025
4623a39
Make SnapshotModelProcessor idempotent. (#35543)
AndriySvyryd Jan 29, 2025
b380647
Update dependencies from https://github.com/dotnet/arcade build 20250…
dotnet-maestro[bot] Feb 3, 2025
5a2a1be
[automated] Merge branch 'release/8.0' => 'release/9.0' (#35474)
AndriySvyryd Feb 3, 2025
095da3c
Update branding to 9.0.3
vseanreesermsft Feb 4, 2025
a0f247d
Merge pull request #35584 from vseanreesermsft/branding-9.0.3-2025-02…
maumar Feb 4, 2025
040757c
Update branding to 8.0.14 (#35583)
vseanreesermsft Feb 4, 2025
fb7d37b
Merge branch 'release/9.0' into merge/release/8.0-to-release/9.0
AndriySvyryd Feb 7, 2025
d73ddce
[automated] Merge branch 'release/8.0' => 'release/9.0' (#35587)
AndriySvyryd Feb 7, 2025
f567bec
Merge branch 'release/9.0-staging' => 'release/9.0' (#35601)
AndriySvyryd Feb 10, 2025
1177a3b
Merge branch 'main' into merge/release/9.0-to-main
AndriySvyryd Feb 10, 2025
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 @@ -5,4 +5,4 @@ variables:
is1ESPipeline: true

${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}
${{ parameter.key }}: ${{ parameter.value }}
24 changes: 17 additions & 7 deletions src/EFCore.Relational/Query/SqlExpressionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -660,20 +660,30 @@ private SqlExpression Not(SqlExpression operand, SqlExpression? existingExpressi
SqlBinaryExpression { OperatorType: ExpressionType.OrElse } binary
=> AndAlso(Not(binary.Left), Not(binary.Right)),

// use equality where possible
// !(a == true) -> a == false
// !(a == false) -> a == true
SqlBinaryExpression { OperatorType: ExpressionType.Equal, Right: SqlConstantExpression { Value: bool } } binary
SqlBinaryExpression
{
OperatorType: ExpressionType.Equal,
Right: SqlConstantExpression { Value: bool },
Left: SqlConstantExpression { Value: bool }
or SqlParameterExpression { IsNullable: false }
or ColumnExpression { IsNullable: false }
} binary
=> Equal(binary.Left, Not(binary.Right)),

// !(true == a) -> false == a
// !(false == a) -> true == a
SqlBinaryExpression { OperatorType: ExpressionType.Equal, Left: SqlConstantExpression { Value: bool } } binary
SqlBinaryExpression
{
OperatorType: ExpressionType.Equal,
Left: SqlConstantExpression { Value: bool },
Right: SqlConstantExpression { Value: bool }
or SqlParameterExpression { IsNullable: false }
or ColumnExpression { IsNullable: false }
} binary
=> Equal(Not(binary.Left), binary.Right),

// !(a == b) -> a != b
SqlBinaryExpression { OperatorType: ExpressionType.Equal } sqlBinaryOperand => NotEqual(
sqlBinaryOperand.Left, sqlBinaryOperand.Right),

// !(a != b) -> a == b
SqlBinaryExpression { OperatorType: ExpressionType.NotEqual } sqlBinaryOperand => Equal(
sqlBinaryOperand.Left, sqlBinaryOperand.Right),
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Query/SqlNullabilityProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ protected virtual SqlExpression VisitSqlBinary(
// we assume that NullSemantics rewrite is only needed (on the current level)
// if the optimization didn't make any changes.
// Reason is that optimization can/will change the nullability of the resulting expression
// and that inforation is not tracked/stored anywhere
// and that information is not tracked/stored anywhere
// so we can no longer rely on nullabilities that we computed earlier (leftNullable, rightNullable)
// when performing null semantics rewrite.
// It should be fine because current optimizations *radically* change the expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,26 @@ public virtual async Task Rewrite_compare_int_with_int(bool async)
public virtual async Task Rewrite_compare_bool_with_bool(bool async)
{
var bools = new[] { false, true };
var onetwothree = new[] { 1, 2, 3 };

foreach (var neq in bools)
{
foreach (var negated in bools)
{
foreach (var negateB in bools)
{
foreach (var nullableA in bools)
foreach (var nullableA in onetwothree)
{
foreach (var negateA in bools)
{
foreach (var nullableB in bools)
foreach (var nullableB in onetwothree)
{
// filter out tests comparing two constants
if (nullableA == 3 && nullableB == 3) continue;

var queryBuilder = (ISetSource ss) =>
{
var data = nullableA
var data = nullableA == 2
? ss.Set<NullSemanticsEntity1>().Select(
e => new
{
Expand All @@ -116,30 +120,47 @@ public virtual async Task Rewrite_compare_bool_with_bool(bool async)
e.BoolB,
e.NullableBoolB
})
: ss.Set<NullSemanticsEntity1>().Select(
e => new
{
e.Id,
A = (bool?)e.BoolA,
e.BoolB,
e.NullableBoolB
});

var query = nullableB
: nullableA == 1
? ss.Set<NullSemanticsEntity1>().Select(
e => new
{
e.Id,
A = (bool?)e.BoolA,
e.BoolB,
e.NullableBoolB
})
: ss.Set<NullSemanticsEntity1>().Select(
e => new
{
e.Id,
A = (bool?)true,
e.BoolB,
e.NullableBoolB
});

var query = nullableB == 2
? data.Select(
e => new
{
e.Id,
e.A,
B = e.NullableBoolB
})
: data.Select(
e => new
{
e.Id,
e.A,
B = (bool?)e.BoolB
});
: nullableB == 1
? data.Select(
e => new
{
e.Id,
e.A,
B = (bool?)e.BoolB
})
: data.Select(
e => new
{
e.Id,
e.A,
B = (bool?)true
});

query = negateA
? query.Select(
Expand Down Expand Up @@ -2467,6 +2488,18 @@ await AssertQueryScalar(
ss => ss.Set<NullSemanticsEntity1>().Where(e => true).Select(e => e.Id));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual async Task Compare_constant_true_to_expression_which_evaluates_to_null(bool async)
{
var prm = default(bool?);

await AssertQueryScalar(
async,
ss => ss.Set<NullSemanticsEntity1>().Where(x => x.NullableBoolA != null
&& !object.Equals(true, x.NullableBoolA == null ? null : prm)).Select(x => x.Id));
}

// We can't client-evaluate Like (for the expected results).
// However, since the test data has no LIKE wildcards, it effectively functions like equality - except that 'null like null' returns
// false instead of true. So we have this "lite" implementation which doesn't support wildcards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4467,7 +4467,7 @@ INNER JOIN (
FROM [Factions] AS [f]
WHERE [f].[Name] = N'Swarm'
) AS [f0] ON [l].[Name] = [f0].[CommanderName]
WHERE [f0].[Eradicated] = CAST(0 AS bit) OR [f0].[Eradicated] IS NULL
WHERE [f0].[Eradicated] <> CAST(1 AS bit) OR [f0].[Eradicated] IS NULL
""");
}

Expand All @@ -4484,7 +4484,7 @@ LEFT JOIN (
FROM [Factions] AS [f]
WHERE [f].[Name] = N'Swarm'
) AS [f0] ON [l].[Name] = [f0].[CommanderName]
WHERE [f0].[Eradicated] = CAST(0 AS bit) OR [f0].[Eradicated] IS NULL
WHERE [f0].[Eradicated] <> CAST(1 AS bit) OR [f0].[Eradicated] IS NULL
""");
}

Expand Down Expand Up @@ -6993,7 +6993,7 @@ FROM [LocustLeaders] AS [l]
INNER JOIN [Factions] AS [f] ON [l].[Name] = [f].[CommanderName]
WHERE CASE
WHEN [f].[Name] = N'Locust' THEN CAST(1 AS bit)
END = CAST(0 AS bit) OR CASE
END <> CAST(1 AS bit) OR CASE
WHEN [f].[Name] = N'Locust' THEN CAST(1 AS bit)
END IS NULL
""");
Expand Down
Loading