[Django] #29847: Window function test failures with MySQL 8

13 views
Skip to first unread message

Django

unread,
Oct 12, 2018, 5:10:34 PM10/12/18
to django-...@googlegroups.com
#29847: Window function test failures with MySQL 8
-------------------------------------+-------------------------------------
Reporter: Tom | Owner: nobody
Forbes |
Type: | Status: new
Uncategorized |
Component: Database | Version: 2.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
With the mysql:8 Docker image I get the following failures on master:

{{{
FAIL: test_lag (expressions_window.tests.WindowFunctionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.7/unittest/case.py", line 59, in
testPartExecutor
yield
File "/usr/local/lib/python3.7/unittest/case.py", line 615, in run
testMethod()
File "/tests/django/tests/expressions_window/tests.py", line 211, in
test_lag
], transform=lambda row: (row.name, row.salary, row.department,
row.lag))
File "/tests/django/django/test/testcases.py", line 975, in
assertQuerysetEqual
return self.assertEqual(list(items), values, msg=msg)
File "/usr/local/lib/python3.7/unittest/case.py", line 839, in
assertEqual
assertion_func(first, second, msg=msg)
File "/usr/local/lib/python3.7/unittest/case.py", line 1045, in
assertListEqual
self.assertSequenceEqual(list1, list2, msg, seq_type=list)
File "/usr/local/lib/python3.7/unittest/case.py", line 1027, in
assertSequenceEqual
self.fail(msg)
File "/usr/local/lib/python3.7/unittest/case.py", line 680, in fail
raise self.failureException(msg)
AssertionError: Lists differ: [('Jones', 45000, 'Accounting', 45000),
('Ad[400 chars]000)] != [('Williams', 37000, 'Accounting', None), ('[400
chars]000)]
}}}

{{{
======================================================================
FAIL: test_lead (expressions_window.tests.WindowFunctionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.7/unittest/case.py", line 59, in
testPartExecutor
yield
File "/usr/local/lib/python3.7/unittest/case.py", line 615, in run
testMethod()
File "/tests/django/tests/expressions_window/tests.py", line 400, in
test_lead
], transform=lambda row: (row.name, row.salary, row.department,
row.hire_date, row.lead))
File "/tests/django/django/test/testcases.py", line 975, in
assertQuerysetEqual
return self.assertEqual(list(items), values, msg=msg)
File "/usr/local/lib/python3.7/unittest/case.py", line 839, in
assertEqual
assertion_func(first, second, msg=msg)
File "/usr/local/lib/python3.7/unittest/case.py", line 1045, in
assertListEqual
self.assertSequenceEqual(list1, list2, msg, seq_type=list)
File "/usr/local/lib/python3.7/unittest/case.py", line 1027, in
assertSequenceEqual
self.fail(msg)
File "/usr/local/lib/python3.7/unittest/case.py", line 680, in fail
raise self.failureException(msg)
AssertionError: Lists differ: [('Williams', 37000, 'Accounting',
datetime.[726 chars]one)] != [('Jones', 45000, 'Accounting',
datetime.dat[726 chars]one)]
First differing element 0:
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29847>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 15, 2018, 9:09:20 AM10/15/18
to django-...@googlegroups.com
#29847: Window function test failures with MySQL 8
-------------------------------------+-------------------------------------
Reporter: Tom Forbes | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

Bisected to 4198445afcba94eb7a25b50c96ec6c2694ed2192.

--
Ticket URL: <https://code.djangoproject.com/ticket/29847#comment:1>

Django

unread,
Oct 15, 2018, 9:11:34 AM10/15/18
to django-...@googlegroups.com
#29847: Window function test failures with MySQL 8
-------------------------------------+-------------------------------------
Reporter: Tom Forbes | Owner: Tom
| Forbes
Type: Bug | Status: assigned

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Forbes):

* cc: Tom Forbes (added)
* owner: nobody => Tom Forbes
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29847#comment:2>

Django

unread,
Oct 21, 2018, 2:48:24 PM10/21/18
to django-...@googlegroups.com
#29847: Window function test failures with MySQL 8
-------------------------------------+-------------------------------------
Reporter: Tom Forbes | Owner: Tom
| Forbes
Type: Bug | Status: assigned
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Florian Apolloner):

PR at https://github.com/django/django/pull/10544

--
Ticket URL: <https://code.djangoproject.com/ticket/29847#comment:3>

Django

unread,
Oct 21, 2018, 4:06:03 PM10/21/18
to django-...@googlegroups.com
#29847: Window function test failures with MySQL 8
-------------------------------------+-------------------------------------
Reporter: Tom Forbes | Owner: Tom
| Forbes
Type: Bug | Status: closed

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Florian Apolloner <apollo13@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"c53af5661313079d022553b6c775e6c4f8d34927" c53af56]:
{{{
#!CommitTicketReference repository=""
revision="c53af5661313079d022553b6c775e6c4f8d34927"
Fixed #29847 -- Ensured proper ordering in queries.

Even though good databases tend to keep the result sorted by the/one
window expression and the planners are smart enough to not resort if not
required, it is not valid to rely on this.

MariaDB specifically did return whatever order it wanted, which is
completely okay. Now we sort towards the expected data for all databases.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29847#comment:4>

Reply all
Reply to author
Forward
0 new messages