NoSQL & Cassandra
Budget: $10 – $30 USD
1/ Cassandra
1. Install Cassandra
2. Insert the data of the taxi dataset (http://archive.ics.uci.edu/ml/datasets/Taxi+Service+Trajectory+-+Prediction+Challenge%2C+ECML+PKDD+2015) into a Cassandra table. We prepared a cleaned-up version of the dataset (without the last column) available at https://drive.google.com/file/d/1G-Vu8yQk5HSY22v6_Jrk8sTp8X28-ixQ/view?usp=sharingLinks to an external site..
Hints:
• See https://docs.datastax.com/en/cql/3.3/cql/cql_using/useInsertCopyCSV.html
• You can first try a smaller file (http://archive.ics.uci.edu/ml/machine-learning-databases/00339/Porto_taxi_data_test_partial_trajectories.csv)
• I got some WriteTimeout errors when I tried importing this table from csv in Docker Cassandra, but the records were actually inserted. If you have trouble with timeouts, try a smaller file, e.g. only keep the first 1000 rows of the file.
3. Write a CQL query to count how many records have ORIGIN_STAND=15
Hints:
• Create an index on ORIGIN_STAND for the query to run faster.
4. Write a CQL query to return the timestamp of tripid='1386499486620000068'
Include in your deliverable screenshots showing the results of the query execution for each query.
2/ In traditional databases, strict consistency ensures that undesirable scenarios are not possible. For example, it is impossible to sell the same flight seat to two users. Given that social network platforms like Twitter use less strict consistency policies, write an example of an undesirable scenario that could arise in the context of Twitter.
3/ Cassandra partitions the key space into ranges, and assigns a range to each server in the cluster (as shown in the ring architecture). Why do the record keys need to be hashed before mapped to a range?
Hint: think of a scenario where the records are tweets and the key is the tweet body (text)
1. Install Cassandra
2. Insert the data of the taxi dataset (http://archive.ics.uci.edu/ml/datasets/Taxi+Service+Trajectory+-+Prediction+Challenge%2C+ECML+PKDD+2015) into a Cassandra table. We prepared a cleaned-up version of the dataset (without the last column) available at https://drive.google.com/file/d/1G-Vu8yQk5HSY22v6_Jrk8sTp8X28-ixQ/view?usp=sharingLinks to an external site..
Hints:
• See https://docs.datastax.com/en/cql/3.3/cql/cql_using/useInsertCopyCSV.html
• You can first try a smaller file (http://archive.ics.uci.edu/ml/machine-learning-databases/00339/Porto_taxi_data_test_partial_trajectories.csv)
• I got some WriteTimeout errors when I tried importing this table from csv in Docker Cassandra, but the records were actually inserted. If you have trouble with timeouts, try a smaller file, e.g. only keep the first 1000 rows of the file.
3. Write a CQL query to count how many records have ORIGIN_STAND=15
Hints:
• Create an index on ORIGIN_STAND for the query to run faster.
4. Write a CQL query to return the timestamp of tripid='1386499486620000068'
Include in your deliverable screenshots showing the results of the query execution for each query.
2/ In traditional databases, strict consistency ensures that undesirable scenarios are not possible. For example, it is impossible to sell the same flight seat to two users. Given that social network platforms like Twitter use less strict consistency policies, write an example of an undesirable scenario that could arise in the context of Twitter.
3/ Cassandra partitions the key space into ranges, and assigns a range to each server in the cluster (as shown in the ring architecture). Why do the record keys need to be hashed before mapped to a range?
Hint: think of a scenario where the records are tweets and the key is the tweet body (text)