karmadip dodiya
karmadip dodiya

Reputation: 231

Is there any way to aggregate table's data in cassandra 2.1.6?

I am new in Cassandra. I want to aggregate my columns like SUM(), MAX(), etc.

So is there any way like functions or query or something that can help me ?

Upvotes: 1

Views: 2909

Answers (1)

Jim Meyer
Jim Meyer

Reputation: 9475

The CQL (Cassandra Query Language) built into Cassandra 2.1.6 only supports the count() aggregation function.

So to do aggregation in Cassandra, there are a few options:

  1. Do a query that returns all the rows you want to aggregate, and sum them on the client side in java/python/etc.

  2. Write your application to do aggregation of your data when inserting it into Cassandra, and update the aggregated data as you insert additional data.

  3. Pair Cassandra with a component like Apache spark using the Cassandra Spark Connector. This requires some effort to learn and set up, but offers aggregation functions and many additional analytics features.

  4. Upgrade to Cassandra 2.2.0 (currently available as release candidate 1). A new feature in 2.2 is support for user defined functions. With UDF you can define aggregation functions. See an example here.

Upvotes: 1

Related Questions