如何在 Cratedb 中 "GROUP BY" 排列列

How to "GROUP BY" array column in Cratedb

例如我有以下脚本:

CREATE TABLE test 
(
     items  array(string)
)

INSERT INTO test (items) VALUES (array['a', 'b']);
INSERT INTO test (items) VALUES (array['a'])

是否可以计算 table 中的项目数?类似于 ES 术语聚合的东西。

我期待这样的事情:

SELECT COUNT(\*), items 
FROM test 
GROUP BY items;

但这会引发错误

Cannot GROUP BY 'items': invalid data type 'string_array'

从 CrateDB 1.0 开始,这是不支持的。参见 this GH issue and this