-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix matching on multiple properties and profiles #101
Conversation
I found problems with this solution when querying using wildcards (e.g. match --LINEAGE "B.1%"). Will reopen this when I find a solution. |
@@ -2442,15 +2441,18 @@ def create_profile_cases( | |||
if match: | |||
case, val = processing_funcs[mutation_type](match) | |||
cases.append( | |||
f"CASE WHEN {' AND '.join(case)} THEN 1 ELSE 0 END AS mutation_{ids[mutation]}" | |||
f"SUM(CASE WHEN {' AND '.join(case)} THEN 1 ELSE 0 END) AS mutation_{ids[mutation]}" |
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.
Why SUM? I think this is nor necessary. If the conditions are met we assign 1 else we assign 0. Makes the comparsion easier
@@ -2551,7 +2553,7 @@ def create_sample_selection_sql( | |||
|
|||
if conditions: | |||
conditions = " AND ".join(conditions) | |||
sql += f" WHERE {conditions}" | |||
sql += f" GROUP BY s.id HAVING {conditions}" |
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.
Is GROUP BY really necessary since it would be very bad for performance.
…es and profiles, including negation
9b21371
to
383c6b4
Compare
Previously there would always be no matches returned when you query for > 1 property. I suspect the same would be the case if you searched for > 1 profile as well, or mixtures of the two. This fix was tested with multiple properties and profiles, as well as negation.
I don't love the
if count == 0
stuff, if you want to rewrite that in a more elegant way then feel free.