-
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
Investigate alternative translations for (in)equality comparison #34165
Comments
EDIT: this was referring to the older alternative translation |
For example Sqlite could use indexes on a predicates like |
The index would not be useable for the |
When comparing a nullable expression to a non-nullable one, a `NULL` result always represent a difference. This makes it possible to avoid duplicating the nullable expression by mapping the `NULL` result to a `FALSE` (when comparing for equality). Fixes dotnet#34165.
When comparing a nullable expression to a non-nullable one, a `NULL` result always represent a difference. This makes it possible to avoid duplicating the nullable expression by mapping the `NULL` result to a `FALSE` (when comparing for equality). Fixes dotnet#34165.
This only referes to "non-optimized" mode, right?
Note that !optimize does occur in predicate, e.g. within negation. In any case, doesn't the switch to |
Yes (for the
Yes, |
When comparing a nullable expression to a non-nullable one, a `NULL` result always represent a difference. This makes it possible to avoid duplicating the nullable expression by mapping the `NULL` result to a `FALSE` (when comparing for equality). Fixes dotnet#34165.
When comparing a nullable expression to a non-nullable one, a `NULL` result always represent a difference. This makes it possible to avoid duplicating the nullable expression by mapping the `NULL` result to a `FALSE` (when comparing for equality). Fixes dotnet#34165.
The current translation of
nullableA == B
isnullableA = B AND nullableA IS NOT NULL
.Similarly,
nullableA != B
is translated tonullableA <> B OR nullableA IS NULL
.This causes the duplication of the
nullableA
expression.Alternative translations that could avoid this issue are
CASE WHEN nullableA == b THEN TRUE ELSE FALSE END
/CASE WHEN nullableA == b THEN FALSE ELSE TRUE END
.The text was updated successfully, but these errors were encountered: