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

Simplify NOT (CASE ... THEN const) by pushing NOT into the THEN/ELSE #33934

Merged
merged 4 commits into from
Jun 11, 2024

Conversation

ranma42
Copy link
Contributor

@ranma42 ranma42 commented Jun 8, 2024

This is an implementation of the optimization suggested in #33857

Fixes #33857

@ranma42
Copy link
Contributor Author

ranma42 commented Jun 8, 2024

Even though it already affects some tests, I am looking for the best place to add tests that specifically check for this transformation.

@maumar
Copy link
Contributor

maumar commented Jun 9, 2024

NorthwindSelect/NorthwindWhere should work, can't go wrong with GearsOfWar either, but that forces duplicating tests into multiple suites. Alternatively, you already have some helpers/infra in the NullSemantics tests, so those could work also.

ranma42 added 4 commits June 9, 2024 20:58
The new test explicitly constructs a negation of a ternary operator, which is
translated as a `NOT (CASE ... END)`.
@ranma42 ranma42 marked this pull request as ready for review June 9, 2024 21:07
@maumar maumar merged commit f9e8b7d into dotnet:main Jun 11, 2024
7 checks passed
@maumar
Copy link
Contributor

maumar commented Jun 11, 2024

another notch on the belt ;) thanks @ranma42 !

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: optimize NOT (CASE WHEN x THEN 1 ELSE 0) by pushing NOT into the THEN/ELSE
3 participants