-
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: fix optsteps panic from InlineSelectVirtualColumns
Previously, running the `optsteps` test command panicked with "could not find path to expr" for queries when `InlineSelectVirtualColumns` was matched. This commit fixes the panic by eliminating the anti-pattern of calling a constructor during the pattern-match phase of a normalization rule. The `optsteps` test command displays step `n` of optimization by running the optimizer twice and halting after `n` and `n - 1` rules have been applied. The difference in the two resulting expressions represents the change in step `n`. `InlineSelectVirtualColumns` previously called `ConstructFiltersItem` during the pattern-match phase of the rule, but only added the constructed filters item to the memo in the replace phase of the rule. When some normalization rule applied during the call to `ConstructFiltersItem` was the last rule applied in a step, the constructed item was not added to the memo because the limit on the number of rules prevented the replace phase of `InlineSelectVirtualColumns`. As a result, `optsteps` panicked when it could not find the normalized `FiltersItem` in the memo. Release note: None
- Loading branch information
Showing
3 changed files
with
33 additions
and
134 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