-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group AND expressions properly to account for nesting #18709
Group AND expressions properly to account for nesting #18709
Conversation
1a8923e
to
d995e4d
Compare
d995e4d
to
8875a22
Compare
Checked commit d-m-u@8875a22 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@miq-bot add_label changelog/yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I worked with @d-m-u on this... @gtanzillo do you have any concern with doing this? It fixes an issue where we were not properly grouping the AND atoms in "A OR B AND C" by always grouping AND expressions. I think this is extra caution but shouldn't break anything if we do needless extra grouping, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parens are our friends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍
Group AND expressions properly to account for nesting (cherry picked from commit 5c506fd) https://bugzilla.redhat.com/show_bug.cgi?id=1720753
Hammer backport details:
|
The sql generated for a nested expression à la
c OR(a AND b)
is incorrect because we're not wrapping the inside expression when it's anAND
. This just adds the wrapping to all ANDs. It results in extra parens in a couple cases but while not having the parens is occasionally detrimental, having too many is never going to hurt us so we should err on the side of too many, methinks.Fixes part of https://bugzilla.redhat.com/show_bug.cgi?id=1660460
It'll require UI changes as well because https://bugzilla.redhat.com/show_bug.cgi?id=1660460#c8 is still an issue