Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get count of elements in Set type column in Cassandra

Tags:

cassandra

cql

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

like image 771
BigDataLearner Avatar asked Mar 11 '14 19:03

BigDataLearner


1 Answers

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 ...

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

like image 158
Daniel Schulz Avatar answered Oct 05 '22 02:10

Daniel Schulz