2017-03-13 4 views
0

Zum Beispiel habe ich das folgende Skript:Wie „GROUP BY“ Array-Spalte in Cratedb

CREATE TABLE test 
(
    items array(string) 
) 

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

Ist es möglich, Anzahl der Elemente in der Tabelle zu zählen? Etwas ähnlich wie ES Begriffe Aggregation.

Ich erwartete etwas wie folgt aus:

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

Aber das löst einen Fehler

kann nicht GROUP BY 'Artikel': ungültiger Datentyp 'string_array'

Antwort