问题
Lets assume I have a Column Family with following schema:
CREATE TABLE users ( user_id timeuuid, name varchar, last_name varchar, children list, phone_numbers map, PRIMARY KEY(user_id) );
Then I insert a row into this CF with "USING TTL 60000". When I want to verify if any of these columns still has TTL set I get error: "Cannot use selection function ttl on collections".
My question is: how to get TTL on elements of a column that is defined as collection ?
Cheers!
回答1:
I reproduced your problem -- naturally getting the very same result. The problem is that either (1) in collections TTL's are element-wise (one TTL per entry in collection) and (2) I found no way of getting entries from Maps or Lists. Of course I can delete one element -- but selecting it or it's TTL was not possible. Even the Datastax' CQL driver v2 has not provided the metadata for that. So you may change your data structure for that. If this was 'just' for testing purposes you have to trust Cassandra doing this well enough.
来源:https://stackoverflow.com/questions/22201000/check-current-ttl-on-collection-columns-in-cassandra