Description:
I didn't check earlier versions.
Verified with 1890e673719e1421faae20ec373f06d830a81b5a of 8.0.
create table t(d date, i int);
insert into t values(null,1),('2017-01-14',3);
select week(d)/10, group_concat(i) from t group by week(d)/10;
week(d)/10 group_concat(i)
NULL 1
0.2000 3
select week(d)/10, group_concat(i) from t group by week(d)/10 desc;
week(d)/10 group_concat(i)
0.2000 3,1
The last result is incorrect: groups of 0.2 and NULL have been wrongly merged. The result should be that of the non-desc query with the order rows reversed.
How to repeat:
create table t(d date, i int);
insert into t values(null,1),('2017-01-14',3);
select week(d)/10, group_concat(i) from t group by week(d)/10 desc;
Suggested fix:
Cached_item_decimal::cmp(), when it transitions from old row containing NULL to new row not containing NULL (which happens as DESC makes NULL come last), wrongly returns FALSE (which means the rows are in the same group, which is wrong). To fix, please imitate Cached_item_int::cmp().
Description: I didn't check earlier versions. Verified with 1890e673719e1421faae20ec373f06d830a81b5a of 8.0. create table t(d date, i int); insert into t values(null,1),('2017-01-14',3); select week(d)/10, group_concat(i) from t group by week(d)/10; week(d)/10 group_concat(i) NULL 1 0.2000 3 select week(d)/10, group_concat(i) from t group by week(d)/10 desc; week(d)/10 group_concat(i) 0.2000 3,1 The last result is incorrect: groups of 0.2 and NULL have been wrongly merged. The result should be that of the non-desc query with the order rows reversed. How to repeat: create table t(d date, i int); insert into t values(null,1),('2017-01-14',3); select week(d)/10, group_concat(i) from t group by week(d)/10 desc; Suggested fix: Cached_item_decimal::cmp(), when it transitions from old row containing NULL to new row not containing NULL (which happens as DESC makes NULL come last), wrongly returns FALSE (which means the rows are in the same group, which is wrong). To fix, please imitate Cached_item_int::cmp().