user1574196
user1574196

Reputation: 1

How to set ttl in a column family using hive

I Am using Datastax for Cassandra and on top of CFS , Iam trying to load the data using Hive.Cassandra having TTL(time to live) at column level while insering and updating.My question is how can we achive the same TTL when we load the data using Hive into the Column Family.Is there any way to specify the TTL for ColumnFamily or while loading from hive??

Example(ref from datastax website) : cqlsh:demodb> INSERT INTO users (user_name, password) VALUES ('cbrown', 'ch@ngem4a') USING TTL 86400;

cqlsh:demodb> UPDATE users USING TTL 432000 SET 'password' = 'ch@ngem4a' WHERE user_name = 'cbrown';

Note: the requirement is to purge the data after a period of time.Cassandra having the option to do that using TTL but iam trying to load the data using Hive.So looking for an option to specify TTL at column Family level or while loading via hive

Upvotes: 0

Views: 1969

Answers (1)

alexLiu
alexLiu

Reputation: 211

Reading data from CF using Hive excludes expired columns. Writing data back to column family can't specify TTL in HIVE, We will add this function soon.

But you can do it in Pig by specifying TTL in the output_query or Hadoop by set TTL in "cassandra.output.cql"

Upvotes: 1

Related Questions