The GROUP BY and FACET statements should aggregate results consistently. Currently, there’s a discrepancy: GROUP BY aggregates by individual array elements, while FACET performs a similar operation but does not display the elements it groups by.
MRE:
mysql> drop table if exists t; create table t (j json); insert into t(j) values('["S","M"]'),('["M","L"]'),('{"a": 1}'),('{"a": 2}'),('[1,2]'),('[{"a":123}, {"b": 123}]'); select groupby(), count(*) from t group by j facet j;
--------------
drop table if exists t
--------------
Query OK, 0 rows affected (0.01 sec)
--------------
create table t (j json)
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
insert into t(j) values('["S","M"]'),('["M","L"]'),('{"a": 1}'),('{"a": 2}'),('[1,2]'),('[{"a":123}, {"b": 123}]')
--------------
Query OK, 6 rows affected (0.00 sec)
--------------
select groupby(), count(*) from t group by j facet j
--------------
+-----------------------+----------+
| groupby() | count(*) |
+-----------------------+----------+
| M | 2 |
| S | 1 |
| L | 1 |
| {"a":1} | 1 |
| {"a":2} | 1 |
| 2 | 1 |
| 1 | 1 |
| [{"a":123},{"b":123}] | 1 |
+-----------------------+----------+
8 rows in set (0.01 sec)
--- 8 out of 8 results in 0ms ---
+-----------------------+----------+
| j | count(*) |
+-----------------------+----------+
| ["S","M"] | 2 |
| ["S","M"] | 1 |
| ["M","L"] | 1 |
| {"a":1} | 1 |
| {"a":2} | 1 |
| [1,2] | 1 |
| [1,2] | 1 |
| [{"a":123},{"b":123}] | 1 |
+-----------------------+----------+
8 rows in set (0.01 sec)
--- 8 out of 8 results in 0ms ---
Bug Description:
The
GROUP BY
andFACET
statements should aggregate results consistently. Currently, there’s a discrepancy:GROUP BY
aggregates by individual array elements, whileFACET
performs a similar operation but does not display the elements it groups by.MRE:
Manticore Search Version:
Manticore 6.3.7 6aa68659d@24102222 dev (columnar 2.3.1 30ad2d6@24100914) (secondary 2.3.1 30ad2d6@24100914) (knn 2.3.1 30ad2d6@24100914)
Operating System Version:
macos
Have you tried the latest development version?
No
Internal Checklist:
To be completed by the assignee. Check off tasks that have been completed or are not applicable.