-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 and improve null semantics rewrites #34072
Conversation
These changes stemmed from #34048, in particular the testing part. |
using the same techniques as projections.
Note that the translation is (mostly) the same as before: x == y in C# translates to the SQL expression (x = y AND x IS NOT NULL AND y IS NOT NULL) OR (x IS NULL AND y IS NULL) other translations are possible, such as: CASE
WHEN x = y OR (x IS NULL AND y IS NULL) THEN TRUE
ELSE FALSE
END (or SELECT [e].[Id], CASE
WHEN [e].[NullableIntA] = [e].[IntB] AND [e].[NullableIntA] IS NOT NULL THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END AS [X]
FROM [Entities1] AS [e] but maybe it is better to tackle this in other ways (for example changing how the pipeline runs, so that the |
now that is one hell of a simplification! 🎉 RIP truth tables (ຈ ﹏ ຈ ) |
AWESOME stuff, thanks a lot @ranma42 ! |
They are useful, but as much as possible I would like to leave that approach to machines (they are much better than people at exhaustively checking that all of the cases match the expectations 😉 ) |
- exhaustive testing of null rewrites - a simpler implementation of the rewrite, which instead of hand-coding all of the cases, combines the generic case and the already available simplifications - a more generic translation of the rewrite optimized for predicates, which simplifies some existing tests.
- exhaustive testing of null rewrites - a simpler implementation of the rewrite, which instead of hand-coding all of the cases, combines the generic case and the already available simplifications - a more generic translation of the rewrite optimized for predicates, which simplifies some existing tests.
This PR contains: