O'Reilly logo

Learning Apache Cassandra - Second Edition by Sandeep Yarabarla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User-defined aggregate functions

Earlier, we created a status_update_views table to keep track of the views on status updates. We also keep track of the origin of these status-update views. They could have originated from a web site, mobile app, or other apps using our API. But to keep track of the count of each type of view, we had to create a separate table with counter columns partitioned by year and clustered by date.

We can also do the same without actually creating a separate table. This can be done using Cassandra's user-defined aggregate functions. You can create custom aggregate functions, which can be applied to data persisting within Cassandra and returned as part of the query result. The coordinator performs aggregation.

Before ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required