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

Translate logical Boolean operators as conditional Boolean operators #33873

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

ranma42
Copy link
Contributor

@ranma42 ranma42 commented Jun 2, 2024

In C# the expected results of logical Boolean operators are the same as those of the conditional Boolean operators (they differ in not being short-circuited); see here.

Instead, in SQL logical operators propagate NULLs. It is possible to avoid complex translations by simply mapping the logical operators to the corresponding conditional ones for Boolean expressions.

Fixes #30245.

In C# the expected results of logical Boolean operators are the same as those of
the conditional Boolean operators, as per the
[documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/boolean-logical-operators#nullable-boolean-logical-operators).

Instead, in SQL logical operators propagate NULLs. It is possible to avoid
complex translations by simply mapping the logical operators to the
corresponding conditional ones for Boolean expressions.

Fixes dotnet#30245.
@maumar maumar merged commit 2c84a6e into dotnet:main Jun 3, 2024
7 checks passed
@maumar
Copy link
Contributor

maumar commented Jun 3, 2024

great optimization, loving the new sql, thanks @ranma42 !

@ranma42 ranma42 deleted the bool-conditional-op branch June 3, 2024 05:45
ranma42 added a commit to ranma42/efcore that referenced this pull request Jun 3, 2024
After dotnet#33873 EFCore emits different queries for the test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query: incorrect results for complex predicate with bitwise AND operation with bool args
3 participants