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

一曲冷凌霜 提交于 2019-12-11 14:46:37

问题


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 ?


回答1:


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.



来源:https://stackoverflow.com/questions/31198733/is-there-any-way-to-aggregate-tables-data-in-cassandra-2-1-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!