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.
131141: opt: add rule to decorrelate union operators r=DrewKimball a=DrewKimball #### opt: improve EnsureKey custom function This commit makes a small improvement to the `EnsureKey` custom function (used in decorrelation rules), so that it can add passthrough columns to a `Project` operator in an effort to find a key. This can prevent rules from adding unnecessary `Ordinality` operators to the query plan. Epic: None Release note: None #### opt: improve exists subquery hoisting This commit makes a small improvement to the subquery-hoisting rules so that hoisting an `EXISTS` subquery can often avoid projecting a new column to check for NULL values. This can allow other optimization rules to match later on. Epic: None Release note: None #### 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 Co-authored-by: Drew Kimball <[email protected]>
- Loading branch information
Showing
13 changed files
with
1,794 additions
and
1,580 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
Oops, something went wrong.