Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5
-
None
Description
As JSON_ARRAYAGG is implemented as a wrapper over Item_func_group_concat, MDEV-11563 is going to affect JSON_ARRAYAGG too.
The problem with DISTINCT in JSON_ARRAYAGG is that it expects the values read from the table for each record. It does not use the key but instead calls val_str() for all the arguments in the GROUP_CONCAT function.
Attachments
Issue Links
- relates to
-
MDEV-11563 GROUP_CONCAT(DISTINCT ...) may produce a non-distinct list
-
- Closed
-
-
MDEV-16620 Add support for JSON_ARRAYAGG and JSON_OBJECTAGG
-
- Closed
-
-
MDEV-22840 JSON_ARRAYAGG gives wrong results with NULL values and ORDER by clause
-
- Closed
-
Now let us port the patch for
MDEV-11563on 10.5 (it is in branch 10.5-varun). The commit is https://github.com/MariaDB/server/commit/f968feed977bf6d684347308a36b7083175d6f55and now running the above test
MariaDB [test]> set tmp_table_size=1024;
Query OK, 0 rows affected (0.001 sec)
MariaDB [test]> select JSON_ARRAYAGG(distinct a) from t1;
+---------------------------+
| JSON_ARRAYAGG(distinct a) |
+---------------------------+
| ["0","1","2","3","4","5"] |
+---------------------------+
1 row in set (0.012 sec)
I get the correct output.