-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
28393: opt: support DISTINCT for aggregates + simplification rules r=RaduBerinde a=RaduBerinde #### opt: support DISTINCT for aggregates Adding optbuilder and execbuilder support for DISTINCT aggregate arguments. We use a new `AggDistinct` operator which acts as a modifier that wraps the Variable argument. Note that DISTINCT does not affect any existing normalization rules; e.g. it does not change whether an aggregation ignores nulls. The existing rules should work just the same; added a few testcases. Release note: None #### opt: remove DISTINCT from aggregations for which it makes no difference Some aggregations, like `min`, are unaffected by `DISTINCT`. Add normalization rule to remove `AggDistinct` in these cases. Release note: None #### opt: remove DISTINCT when argument is unique within group This change introduces a rule that removes `AggDistinct` if we can prove that there are no duplicate input values within a group (i.e. the input column plus the grouping columns form a key). Release note: None 28411: sql: disallow specifying both FORCE_INDEX and NO_INDEX_JOIN r=RaduBerinde a=RaduBerinde The current code allows both `FORCE_INDEX` and `NO_INDEX_JOIN` "hints", and the query fails if the index we force requires index-join. This semantic would be tricky to support with the optimizer (it would be a "no-plans" condition during exploration). This commit changes the behavior to disallow setting both hints at the same time. The code to combine and validate `IndexHints` is moved in a method; the code is kept general even though with this change it's never valid to have more than one parameter. Release note (sql change): It is now an error to specify both FORCE_INDEX and NO_INDEX_JOIN hints at the same time. Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
- Loading branch information
Showing
39 changed files
with
963 additions
and
235 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
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
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.