Hi
I want to set TTL 30 days from the time field of table record(id,name,time)
during insertion.For this I am creating a User Defined Function(UDF) bigint
fun(rTime,cTime) as
CREATE FUNCTION fun(rtime timestamp,ctime timestamp) CALLED ON NULL INPUT
RETURNS bigint LANGUAGE java as 'return 2592000-((ctime.toTime()
-rtime.toTime())/1000);';
here,function fun is calculating the time in seconds this data should live.
2592000 is the time in seconds for 30 days.
I am trying to use above function for setting TTL as
INSERT INTO record(id,name,time) VALUES (123,'data123','2016-08-08
06:06:00') USING TTL fun('2016-08-08 06:06:00',totimestamp(now()));
getting error as
Syntax Exception: ErrorMessage code=2000 ........
Is there any other way to set ttl based on record time field. What is
problem with above approach.
Thanks.
Sujeet
--
--
Sujeet Kumar
ME(CSA)
IISc Banglore
[email protected]
[email protected]