What data structure should I use to mimic "order by counter" in Cassandra?

kha

Let's say I currently have a table like this

create table comment_counters
{ 
    contentid uuid,
    commentid uuid,
    ...
    liked counter,
    PRIMARY_KEY(contentid, commentid)
 };

This purpose of this table is to track the comments and the number of times individual comments have been "liked".

What I would like to do is to get the top comments (let's say 20 top comments) determined by their number of likes from this table for each content.

I know there's no way to order by counters so what I would like to know is, are there any other ways to do this in Cassandra, by restructuring my tables or tracking more/different information for instance, or am I left with no choice but to do this in an RDBMS?

Sorting in client is not really an option I would like to consider at this stage.

Stefan Podkowinski

Unfortunately there's now way to do this type of aggregations using plain Cassandra queries. The best option for doing this kind of data analysis would be to use an external tool such as Spark. Using Spark you can start periodical jobs that would read and aggregate all counters from the comment_counters table and afterwards write the results (such as top 20 comments) to a different table that you can use to query directly afterwards. See here to get started with Cassandra and Spark.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What data structure should I use to mimic "order by counter" in Cassandra?

From Dev

What data structure should I use for sentiment analysis?

From Dev

What data structure should I use for a music play queue?

From Dev

What data structure should I use to represent this board?

From Dev

What data structure should I use for sentiment analysis?

From Dev

What data structure I should use for my dictionary?

From Dev

Directory structure - what path should I use?

From Dev

Which data structure should I use in Java?

From Dev

How to maintain city road data? (What data structure should I use)

From Dev

What data structure should I use to look up a string from an array of possible strings?

From Dev

What version of Java should I use with Cassandra 2.0?

From Dev

What data structure should I organize my data in?

From Dev

Should I use different HDD for Cassandra commit log and data?

From Dev

What data type I should use for versioning?

From Dev

What type of data should I use (MySQL)?

From Dev

Which data structure should I use to handle multi value data?

From Dev

What structure should I use to store key and list of possible values?

From Dev

Simple android app, what structure should I use?

From Dev

What structure should I use to get a user with the highest score

From Dev

What data structure should I be using to get rid of [ ]?

From Dev

Which data structure should I use to search a string from CSV?

From Dev

Which data structure should I use for maintaining this information?

From Dev

What should I use for this?

From Dev

Theoretically, what data structure can I use for trees with shared memory?

From Dev

Theoretically, what data structure can I use for trees with shared memory?

From Dev

What address should i use for listen_address in cassandra.yaml ?

From Dev

What data type should I use for IETF language codes?

From Dev

MySQL - what data type should i use to store a set of strings

From Dev

MySQL - What data type should I use to store a Map field

Related Related

  1. 1

    What data structure should I use to mimic "order by counter" in Cassandra?

  2. 2

    What data structure should I use for sentiment analysis?

  3. 3

    What data structure should I use for a music play queue?

  4. 4

    What data structure should I use to represent this board?

  5. 5

    What data structure should I use for sentiment analysis?

  6. 6

    What data structure I should use for my dictionary?

  7. 7

    Directory structure - what path should I use?

  8. 8

    Which data structure should I use in Java?

  9. 9

    How to maintain city road data? (What data structure should I use)

  10. 10

    What data structure should I use to look up a string from an array of possible strings?

  11. 11

    What version of Java should I use with Cassandra 2.0?

  12. 12

    What data structure should I organize my data in?

  13. 13

    Should I use different HDD for Cassandra commit log and data?

  14. 14

    What data type I should use for versioning?

  15. 15

    What type of data should I use (MySQL)?

  16. 16

    Which data structure should I use to handle multi value data?

  17. 17

    What structure should I use to store key and list of possible values?

  18. 18

    Simple android app, what structure should I use?

  19. 19

    What structure should I use to get a user with the highest score

  20. 20

    What data structure should I be using to get rid of [ ]?

  21. 21

    Which data structure should I use to search a string from CSV?

  22. 22

    Which data structure should I use for maintaining this information?

  23. 23

    What should I use for this?

  24. 24

    Theoretically, what data structure can I use for trees with shared memory?

  25. 25

    Theoretically, what data structure can I use for trees with shared memory?

  26. 26

    What address should i use for listen_address in cassandra.yaml ?

  27. 27

    What data type should I use for IETF language codes?

  28. 28

    MySQL - what data type should i use to store a set of strings

  29. 29

    MySQL - What data type should I use to store a Map field

HotTag

Archive