-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: simplify IS filters for selects and joins
Previously, a filter in the condition of a `Select` or `Join` could not simplify an expression of the following form: `<expr> IS (True | False)` This could prevent other rules from firing - contradiction detection, for example. This patch allows the SimplifyFilters logic to effect the following transformation on `IS` expressions in the filters of a `Select` or `Join`: ``` <expr> IS True => <expr> <expr> IS False => NOT <expr> ``` Note that the original `IS` expression would return `False` on a null input, whereas the replacement expression could return `Null`. In the case when the `IS` expression is a `Select` or `Join` condition, this does not matter, because `False` and `Null` conditions are treated the same way (no rows returned). However, the same logic does not apply to `IS NOT`, because then `True` values would become `Null`, since `Null IS NOT True` returns `True`. This would result in less rows being returned. Currently, only IS expressions that are top-level conjuncts of the filters are simplified for the sake of simplicity. Fixes #58283 Release note: None
- Loading branch information
1 parent
f23df8a
commit 1faee2d
Showing
6 changed files
with
324 additions
and
91 deletions.
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.