summaryrefslogtreecommitdiff
path: root/tests/aggregation
AgeCommit message (Collapse)Author
2021-02-24[3.2.x] Fixed #32478 -- Included nested columns referenced by subqueries in ↵Simon Charette
GROUP BY on aggregations. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Refs #31094, #31150. Thanks Igor Pejic for the report. Backport of 277eea8fcced7f04f3800617f189beb349a3212e from master
2020-12-10Fixed #32178 -- Allowed database backends to skip tests and mark expected ↵Hasan Ramezani
failures. Co-authored-by: Tim Graham <timograham@gmail.com>
2020-11-27Fixed #25534, Fixed #31639 -- Added support for transform references in ↵Ian Foote
expressions. Thanks Mariusz Felisiak and Simon Charette for reviews.
2020-11-06Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.Hasan Ramezani
This also replaces assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-11-03Fixed #32166 -- Removed redundant definition of Greatest in ↵Sicong
test_expression_on_aggregation.
2020-10-21Fixed #26390 -- Disabled grouping by Random().Étienne Beaulé
Thanks to Tzu-ping Chung for the tests.
2020-09-29Fixed #31880 -- Made QuerySet.aggregate() raise FieldError when aggregating ↵David Wobrock
over aggregation aliases.
2020-08-17Fixed #31888 -- Avoided module-level MySQL queries in tests.Ahmad A. Hussein
2020-07-15Refs #30446 -- Removed unnecessary Value(..., output_field) in docs and tests.Simon Charette
2020-07-15Fixed #30446 -- Resolved Value.output_field for stdlib types.Simon Charette
This required implementing a limited form of dynamic dispatch to combine expressions with numerical output. Refs #26355 should eventually provide a better interface for that.
2020-05-14Fixed #31568 -- Fixed alias reference when aggregating over multiple subqueries.Simon Charette
691def10a0197d83d2d108bd9043b0916d0f09b4 made all Subquery() instances equal to each other which broke aggregation subquery pushdown which relied on object equality to determine which alias it should select. Subquery.__eq__() will be fixed in an another commit but Query.rewrite_cols() should haved used object identity from the start. Refs #30727, #30188. Thanks Makina Corpus for the report.
2020-03-25Fixed #31377 -- Disabled grouping by aliases on ↵Hasan Ramezani
QuerySet.values()/values_list() when they collide with field names. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Thanks Holovashchenko Vadym for the report.
2020-03-03Refs #31331 -- Checked ONLY_FULL_GROUP_BY mode in ↵Mariusz Felisiak
AggregateTestCase.test_aggregation_subquery_annotation_multivalued().
2020-03-03Fixed #31150 -- Included subqueries that reference related fields in GROUP ↵Mariusz Felisiak
BY clauses. Thanks Johannes Hoppe for the report. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Co-authored-by: Simon Charette <charette.s@gmail.com>
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2020-02-03Fixed #31217 -- Made QuerySet.values()/values_list() group by not selected ↵Mariusz Felisiak
annotations with aggregations used in order_by(). Regression in 59b4e99dd00b9c36d56055b889f96885995e4240. Thanks Jon Dufresne for the report and Simon Charette for the review.
2020-01-15Refs #31136 -- Made QuerySet.values()/values_list() group only by selected ↵Mariusz Felisiak
annotation. Regression in 0f843fdd5b9b2f2307148465cd60f4e1b2befbb4.
2020-01-04Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().Mariusz Felisiak
Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Thanks Sigurd Ljødal for the report.
2019-12-23Fixed #31109 -- Disabled grouping by aliases on QuerySet.exists().Simon Charette
Clearing the SELECT clause in Query.has_results was orphaning GROUP BY references to it. Thanks Thierry Bastian for the report and Baptiste Mispelon for the bisect. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80.
2019-12-19Fixed #31094 -- Included columns referenced by subqueries in GROUP BY on ↵Simon Charette
aggregations. Thanks Johannes Hoppe for the report. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-12-19Refs #31094 -- Added test for not using aliases in GROUP BY clauses.Simon Charette
2019-11-18Relaxed some query ordering assertions in tests.Tim Graham
It accounts for differences seen on cockroachdb.
2019-07-31Fixed #30665 -- Added support for distinct argument to Avg() and Sum().Étienne Beaulé
2019-07-31Moved test for distinct Count() to a separate test case.Étienne Beaulé
2019-06-10Fixed #30548 -- Improved exception when expression contains mixed types.CruxBox
2019-06-05Fixed #30542 -- Fixed crash of numerical aggregations with filter.Étienne Beaulé
Filters in annotations crashed when used with numerical-type aggregations (i.e. Avg, StdDev, and Variance). This was caused as the source expressions no not necessarily have an output_field (such as the filter field), which lead to an AttributeError: 'WhereNode' object has no attribute output_field. Thanks to Chuan-Zheng Lee for the report. Regression in c690afb873cac8035a3cb3be7c597a5ff0e4b261 and two following commits.
2019-05-08Refs #30462 -- Added test for conditional aggregation on annotated subquery.Mariusz Felisiak
2019-03-23Fixed #30246 -- Reused annotation aliases references in aggregation filters.Simon Charette
Thanks Jan Baryła for the detailed report and the reduced test case.
2019-03-21Fixed #30158 -- Avoided unnecessary subquery group by on aggregation.Simon Charette
Subquery annotations can be omitted from the GROUP BY clause on aggregation as long as they are not explicitly grouped against. Thanks Jonny Fuller for the report.
2019-01-21Fixed #30120 -- Fixed invalid SQL in distinct aggregate.Simon Charette
Regression in bc05547cd8c1dd511c6b6a6c873a1bc63417b111 (refs #28658).
2019-01-14Refs #28643 -- Changed Avg() to use NumericOutputFieldMixin.Nick Pope
Keeps precision instead of forcing DecimalField to FloatField.
2019-01-09Fixed #28658 -- Added DISTINCT handling to the Aggregate class.Simon Charette
2018-12-06Fixed #30011 -- Fixed queries that reuse filtered aggregates.Simon Charette
Thanks Taqi Abbas and Raphael Kimmig for the report.
2018-08-23Fixed #29048 -- Added **extra_context to database function as_vendor() methods.priyanshsaxena
2018-02-02Simplified aggregation.tests. Mariusz Felisiak
2017-08-12Fixed #27849 -- Added filtering support to aggregates.Tom
2017-07-21Refs #24887 -- Stopped mutating a test expression during as_sql().Simon Charette
Also defined an explicit output_field as it was mixing an expression with an IntegerField() with one with a DecimalField().
2017-07-11Fixed #28382 -- Prevented BaseExpression._output_field from being set if ↵Sergey Fedoseev
_resolve_output_field() fails.
2017-06-29Fixed #28277 -- Added validation of QuerySet.annotate() and aggregate() args.Mariusz Felisiak
Thanks Tim Graham and Nick Pope for reviews.
2017-06-01Refs #23968 -- Removed unnecessary lists, generators, and tuple calls.Jon Dufresne
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-18Refs #23919 -- Removed python_2_unicode_compatible decorator usageClaude Paroz
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2017-01-14Fixed tests that rely on hardcoded id with keepdbJosh Smeaton
2016-11-10Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za
2016-04-05Fixed #26458 -- Based Avg's default output_field resolution on its source ↵Simon Charette
field type. Thanks Tim for the review and Josh for the input.
2016-03-28Sorted single letter imports per the latest version of isort.Tim Graham
2016-01-29Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as ↵Hasan
appropriate.
2015-12-03Fixed many spelling mistakes in code, comments, and docs.Josh Soref
2015-09-23Refs #14030 -- Removed backwards compatiblity for old-style aggregates.Tim Graham
Per deprecation timeline.