在Cassandra中的“设置类型”列中获取元素数 [英] Get count of elements in Set type column in Cassandra

查看:253
本文介绍了在Cassandra中的“设置类型”列中获取元素数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取Cassandra(cql)中Set的列中元素的计数;
eg;表中的列具有值{'9970GBBHVOB61','9970GBBHVOB62','9970GBBHVOB6O'}。我希望从查询中返回3。

how to get the count of elements in a column in Cassandra (cql) which is of Set; e.g; a Column in a table has value {'9970GBBHVOB61', '9970GBBHVOB62', '9970GBBHVOB6O'} .I want 3 to be returned from the query

推荐答案

不幸的是,即使在CQL Driver v2中的Collections-support也不完美:你可以在upsert语句中添加或删除项目。但更多的是,他们,像做一个项目选择,要求收集项目的TTL或要求的集合的大小,是不支持。所以你必须

unfortunately the Collections-support even in CQL Driver v2 is not perfect: you may add or delete items in upsert statements. But more on them, like doing an item select, asking for collection item's TTLs or asking for the collection's size, is not supported. So you have to

resultset: SELECT collection_column FROM ...

然后通过 resultset.one() resultet.all 并获得 item.size()自己。对不起,对不起。

and then take item by resultset.one() or resultset.all() and get item.size() yourself. Sorry abut that.

这篇关于在Cassandra中的“设置类型”列中获取元素数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆