-
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.
48298: opt: add rule to fold remappings of ValuesExpr columns r=andy-kimball a=DrewKimball Previously, the optimizer had no rule to fold projected remappings of columns from a ValuesExpr. This patch adds a rule that folds any ProjectionsItems into the passthrough set if: 1. The projection does nothing but remap a colum from the input. 2. The column being remapped is not itself in the passthrough set. The Values output columns are replaced by the corresponding columns projected by the folded ProjectionsItems so that logical equivalency is preserved. Example: ``` project ├── columns: x:2!null ├── values │ ├── columns: column1:1!null │ ├── cardinality: [2 - 2] │ ├── (1,) │ └── (2,) └── projections └── column1:1 [as=x:2, outer=(1)] => project ├── columns: x:2!null └── values ├── columns: x:2!null ├── cardinality: [2 - 2] ├── (1,) └── (2,) ``` In this example, the project can now be removed altogether. Fixes: #48083 Release note: None Co-authored-by: Drew Kimball <[email protected]>
- Loading branch information
Showing
7 changed files
with
496 additions
and
122 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
Oops, something went wrong.