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 we proceed with the aggregation, let's populate the status_update_views table with raw data:
INSERT INTO "status_update_views" ("status_update_username...