-
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
Fix to #16078 - Query/Null semantics: when checking if expression is null, just check it's constituents rather than entire expression #18560
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maumar
force-pushed
the
fix16078
branch
2 times, most recently
from
October 24, 2019 01:31
8fd57dc
to
baf9d53
Compare
smitpatel
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/NullSemanticsRewritingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
smitpatel
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
smitpatel
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs
Show resolved
Hide resolved
src/EFCore.Relational/Query/Internal/NullSemanticsRewritingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
smitpatel
reviewed
Oct 24, 2019
...onalShapedQueryCompilingExpressionVisitor.ParameterNullabilityOptimizingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
new version up |
smitpatel
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/NullSemanticsRewritingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
up |
smitpatel
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
smitpatel
approved these changes
Oct 24, 2019
test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs
Outdated
Show resolved
Hide resolved
roji
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/NullSemanticsRewritingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
roji
reviewed
Oct 24, 2019
...onalShapedQueryCompilingExpressionVisitor.ParameterNullabilityOptimizingExpressionVisitor.cs
Show resolved
Hide resolved
roji
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/NullSemanticsRewritingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
new version up, made some changes, please take a final peek @smitpatel @roji |
smitpatel
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/IsNullOptimizingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
smitpatel
reviewed
Oct 24, 2019
src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
…null, just check it's constituents rather than entire expression Problem was that during null semantics rewrite we create IS NULL calls on the operands of the comparison. If the operands themselves are complicated, we were simply comparing the entire complex expression to null. In some cases, we only need to look at constituents, e.g. a + b == null <=> a == null || b == null. Also added other minor optimizations around null semantics: - non_nullable_column IS NULL resolves to false, - try to simplify expression after applying de Morgan transformations Also fixed a bug exposed by these changes, where column nullability would be incorrect for scenarios with owned types.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem was that during null semantics rewrite we create IS NULL calls on the operands of the comparison. If the operands themselves are complicated, we were simply comparing the entire complex expression to null. In some cases, we only need to look at constituents, e.g. a + b == null <=> a == null || b == null.
Also added other minor optimizations around null semantics:
Also fixed a bug exposed by these changes, where column nullability would be incorrect for scenarios with owned types.