forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: add rule to decorrelate unions in EXISTS subqueries
This commit adds a new rule `TryDecorrelateUnion`, which matches on a `Union` or `UnionAll` operator in the input of a `ScalarGroupBy`. The `ScalarGroupBy` must have "any-not-null" semantics, meaning it produces an arbitrary non-null value from each input column. If these conditions are satisfied, the `Union` operator is replaced by an `InnerJoin` between two `ScalarGroupBy` operators. A `Project` coalesces columns from each side of the join to produce the final aggregated values. This transformation does not itself decorrelate the `Union` operators, but it does make it easier for other rules to do so. Release note: None Epic: None
- Loading branch information
1 parent
5bc3c1e
commit 1ec3568
Showing
3 changed files
with
438 additions
and
0 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
Oops, something went wrong.