AQL command for getting the count of distinct values in a particular bin of the set


#1

Is there an AQL command for getting the count of the number of distinct values in a particular bin of a given set? If not is there any other shorter way?


#2

Aerospike is a record centric database. record#1 can have bin “mybin” with integer value, record#2 can have “mybin” holding a string, another record could have same bin name with a List datatype etc. Its not organized by “column”. So natively it is not possible to do what you looking for. You can implement a stream udf (user defined function) to do such an operation on all the records and get the count. But you will have to write the stream udf yourself. See the docs for Stream UDFs. https://www.aerospike.com/docs/guide/aggregation.html (BTW, you can execute your stream UDF through AQL - but you have to write the UDF.)