Logical expression optimizer in new analyzer#46644
Merged
antonio2368 merged 8 commits intomasterfrom Mar 8, 2023
Merged
Conversation
hanfei1991
reviewed
Feb 21, 2023
novikd
reviewed
Feb 21, 2023
Member
Author
|
@novikd I changed/added a bunch of things, please tell me if it's okay/going in the right direction. |
novikd
reviewed
Mar 2, 2023
| const auto & settings = getSettings(); | ||
| if (equals_functions.size() < settings.optimize_min_equality_disjunction_chain_length && !expression.node->getResultType()->lowCardinality()) | ||
| { | ||
| std::move(equals_functions.begin(), equals_functions.end(), std::back_inserter(or_operands)); |
Member
There was a problem hiding this comment.
Can we introduce problems if operands order has changed?
Member
Author
There was a problem hiding this comment.
I can't think of anything logical with OR because we take only the equality functions that have constants + we move the IN operator to the back.
Maybe short-circuiting can perform better in some cases but that should be performance only and it's case dependant.
novikd
approved these changes
Mar 7, 2023
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add logical expression optimizer to new analyzer.
Documentation entry for user-facing changes