Looking to filter all users who 'held' during a particular date range without using the IN() statement with a list of each date in Cassandra, but the caveat is that there are 3 partition keys in my table. If this is possible using token() function in Cassandra, please share.
Here's the example table:
CREATE TABLE priceOverTime (
id text,
date timestamp,
action text,
price double,
PRIMARY KEY ((id, date, action), price)
)
..
Partition keys: id, time, action
Clustering keys: price
Trying to use something similar to this StackOverflow question, but can't get it to return the desired output.
SELECT * FROM priceOverTime WHERE date > '2017-01-01 00:00:00+0000'
AND date <= '2017-01-04 23:00:00+0000'
AND token(id) > previous_token
AND token(action) = token('hold')
AND LIMIT 100 ALLOW FILTERING;
Example Data
id | date | action | price
--------------------------+----------
1 | 2017-01-01 00:00:00-0000 | buy | 100
1 | 2017-01-02 00:00:00-0000 | buy | 105
1 | 2017-01-03 00:00:00-0000 | sell | 103
1 | 2017-01-04 00:00:00-0000 | buy | 102
2 | 2017-01-01 00:00:00-0000 | buy | 100
2 | 2017-01-02 00:00:00-0000 | sell | 105
2 | 2017-01-03 00:00:00-0000 | hold | 103
2 | 2017-01-04 00:00:00-0000 | hold | 102
Desired Output
2 | 2017-01-03 00:00:00-0000 | hold | 103
2 | 2017-01-04 00:00:00-0000 | hold | 102
Note: Using Cassandra Version 2.2. Also, my version of Cassandra does suggest using token() function for this type of filtering -- shown in a previous error message.