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

Fixed #25307 -- Conditional aggregation over subqueries #6266

Closed
wants to merge 2 commits into from

Conversation

newportt
Copy link

Handle WhereNode instances in Query.rewrite_cols() to allow
conditional aggregations over subqueries
attribute 'get_source_expressions'.

Tests conditional aggregations over subqueries.
"""
Copy link
Member

Choose a reason for hiding this comment

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

I think this could benefit from being split in multiple test methods.

@akaariai
Copy link
Member

As said in the ticket, I believe the correct approach is to add get_source_expressions()/set_source_expressions() to WhereNode and Lookup. See #6267.

@newportt
Copy link
Author

@akaariai I made some changes in 4063654 to split out the unit tests and add another assertion for the isinstance(self.group_by, list) case. This can be closed in favor of #6267

@timgraham timgraham closed this Mar 11, 2016
@akaariai
Copy link
Member

I added the tests in a separate commit to give credit for the real author of the tests.

@e78908b943c8
Copy link

e78908b943c8 commented Jun 7, 2016

ValueError: too many values to unpack (expected 2)

This seems to fail with the above exception if multiple conditions are passed to When as such

Sum(Case(When(date__gte=dr.start, date__lt=dr.end, then='price')))

@charettes
Copy link
Member

@e78908b943c8, this was superseded by #6267. If it also exhibit the same failures please report it there instead.

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.

5 participants