Skip to content
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 Use OR conjuctive in filterAny aggregate queries #10778

Merged

Conversation

emteknetnz
Copy link
Member

Issue #10744

@emteknetnz emteknetnz force-pushed the pulls/5/aggregate-having branch 3 times, most recently from 5d11357 to 25a4488 Compare May 15, 2023 22:36
@emteknetnz emteknetnz marked this pull request as ready for review May 15, 2023 22:43
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't done a full review of this, as it seems likely that a lot will need to change to account for not making the API breaking changes.

@emteknetnz emteknetnz force-pushed the pulls/5/aggregate-having branch from 25a4488 to 505e661 Compare May 16, 2023 22:11
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things that don't fit in code comments:

Which branch to target

This is a bug fix so arguably should target 4.13 or 5.0 - I'm guessing you're targetting 5 because of the API change?
I'm on the fence so I'll raise the question but not ask for one or the other.

How did it used to work?

I can't find anything in this PR that points at how the original HAVING clause was built.... it might just be that I missed it, but I'm a little worried that this solution is just side-stepping whatever the original mechanism was, which might mean we're left with dead code.

@emteknetnz
Copy link
Member Author

Which branch to target

One of the ACs is:

Fix is targeted at 5.1. We won't fix this in CMS 4.

How did it used to work? .. I can't find anything in this PR that points at how the original HAVING clause was built

I'm not sure either, though it's also not really relevant? Somewhere else in the ORM a HAVING clause was chosen to be used, which may seem a little weird though it's fine since it still does what it needs to. Changing the HAVING clause to a WHERE clause is out of scope for this bugfix PR. Also probably no point in doing so.

@GuySartorelli
Copy link
Member

Good point on the AC, I forgot about that - I'll need to make more of an effort to remember to check that more frequently while reviewing lest I review out of context 😅

I'm not sure either, though it's also not really relevant? Somewhere else in the ORM a HAVING clause was chosen to be used, which may seem a little weird though it's fine since it still does what it needs to. Changing the HAVING clause to a WHERE clause is out of scope for this bugfix PR. Also probably no point in doing so.

I'm not saying we should change from HAVING to WHERE - what I'm saying is that the mechanism that was previously deciding this code should result in a HAVING clause is no longer being used in this scenario - so it may be dead code. We should be making a reasonable effort to avoid having dead code.

@emteknetnz
Copy link
Member Author

what I'm saying is that the mechanism that was previously deciding this code should result in a HAVING clause is no longer being used in this scenario ?

I'm confused - the HAVING clause is still being used? The point of the code update is to simply to change the conjunctive in the HAVING clause from AND to OR

@emteknetnz emteknetnz force-pushed the pulls/5/aggregate-having branch from 505e661 to 3ded149 Compare May 16, 2023 23:07
@GuySartorelli
Copy link
Member

As per discussion IRL - the old mechanism is still in use for other purposes so no change needed for that.

@emteknetnz emteknetnz force-pushed the pulls/5/aggregate-having branch from 3ded149 to 3b9254b Compare May 16, 2023 23:36
@emteknetnz emteknetnz force-pushed the pulls/5/aggregate-having branch from 3b9254b to 696fe79 Compare May 16, 2023 23:56
@GuySartorelli GuySartorelli merged commit 0151ab5 into silverstripe:5 May 17, 2023
@GuySartorelli GuySartorelli deleted the pulls/5/aggregate-having branch May 17, 2023 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants