Check current TTL on collection columns in Cassandra
Asked Answered
H

1

2

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!

Heidelberg answered 5/3, 2014 at 14:45 Comment(0)
F
2

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.

Fluoroscope answered 3/5, 2014 at 19:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.