[ 
https://issues.apache.org/jira/browse/CASSANDRA-17425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504989#comment-17504989
 ] 

Andres de la Peña commented on CASSANDRA-17425:
-----------------------------------------------

Indeed I have an old patch for CASSANDRA-8877 allowing to do things like:
{code}
CREATE TABLE IF NOT EXISTS t (k int PRIMARY KEY, s set<int>);
INSERT INTO t (k, s) VALUES (1, {1, 2}) USING TIMESTAMP 100 AND TTL 10000;
UPDATE t USING TIMESTAMP 200 AND TTL 20000 SET s += {3} WHERE k=1;

SELECT s, WRITETIME(s), TTL(s) FROM t;

 s         | writetime(s)    | ttl(s)
-----------+-----------------+-----------------------
 {1, 2, 3} | [100, 100, 200] | [10000, 10000, 20000]


SELECT s[2], WRITETIME(s[2]), TTL(s[2]) FROM t;

 s[2] | writetime(s[2]) | ttl(s[2])
------+-----------------+-----------
    2 |             100 |     10000
{code}
It returns lists of timestamps/ttls for multi-cell columns, so one could apply 
a function to the results. I could undust that patch, although it is relatively 
large and quite old, so I'd take me some time.
 

> Add new CQL function maxWritetime
> ---------------------------------
>
>                 Key: CASSANDRA-17425
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17425
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Syntax
>            Reporter: Yifan Cai
>            Assignee: Yifan Cai
>            Priority: Normal
>
> The function "writetime" does not support multi-cell types, e.g. collections 
> and UDT. It would be useful to enable querying the latest modified timestamp 
> of a column value. 
> I'd like to propose to add a new function named "maxWritetime", which returns 
> the largest timestamp amongst the cells. When being applied to the single 
> cell types, it returns the same result as "writetime".



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to