Cassandra CQL 3.11 - How to use group by?

被刻印的时光 ゝ 提交于 2019-12-24 10:45:51

问题


How to use group by clause in Cassandra 3.11 ? I followed this link - Group by in CQL for Cassandra DB not working

although the answer is accepted but when I created the same table and run the query , it is showing different result (not as expected)

the steps I followed are -

create table hashtags(
id uuid,
texts text,
frequence int,
primary key ((texts), frequence, id))
with clustering order by (frequence desc, id asc);

then inserted some dummy data -

after that run following query -

select texts, sum(frequence) from hashtags group by texts;

and the output is -

Expected output -

 text  | system.sum(frequence)
-------+-----------------------
 hello |                    10
    hi |                     7

来源:https://stackoverflow.com/questions/56003345/cassandra-cql-3-11-how-to-use-group-by

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!