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

Fix to #16078 - Query/Null semantics: when checking if expression is null, just check it's constituents rather than entire expression #18560

Merged
merged 1 commit into from
Oct 24, 2019

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Oct 24, 2019

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.

@maumar
Copy link
Contributor Author

maumar commented Oct 24, 2019

new version up

@maumar
Copy link
Contributor Author

maumar commented Oct 24, 2019

up

@maumar
Copy link
Contributor Author

maumar commented Oct 24, 2019

new version up, made some changes, please take a final peek @smitpatel @roji

…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.
@maumar maumar merged commit 07c0940 into release/3.1 Oct 24, 2019
@maumar maumar deleted the fix16078 branch October 24, 2019 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants