[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2024-06-20 Thread Michael Semb Wever (Jira)


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

Michael Semb Wever commented on CASSANDRA-18078:


dev ML thread: https://lists.apache.org/thread/vscl41hvr9vnd4kko1xrsp8242h2xhm0 
 (thanks Stefan for raising it)

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0.x
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2024-06-20 Thread Stefan Miklosovic (Jira)


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

Stefan Miklosovic commented on CASSANDRA-18078:
---

[~mck]

I don't have any problem with delivering this (removing it from 5.0).

What we should do about the "add-on" which introduces the application of 
collection functions to a non-collection type? That is strictly speaking a new 
feature and should go probably just to trunk.

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0.x
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2024-06-20 Thread Michael Semb Wever (Jira)


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

Michael Semb Wever commented on CASSANDRA-18078:


what's the latest here?  are we ok going 5.0 GA without this?

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
> Fix For: 5.0.x
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-12-02 Thread Jira


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

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

Just created CASSANDRA-18085 to add support for not-collection arguments on CQL 
collection functions.

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
> Fix For: 4.2
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-12-01 Thread Francisco Guerrero (Jira)


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

Francisco Guerrero commented on CASSANDRA-18078:


[~adelapena] I took a look the new commit, and even though it makes sense, I am 
with [~yifanc] here that it would make more sense to move the singleton 
collection function portion to a patch (new issue). What do you think?

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
> Fix For: 4.2
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-12-01 Thread Yifan Cai (Jira)


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

Yifan Cai commented on CASSANDRA-18078:
---

Thank you for adding the capability! I also checked the case of map, 
`collection_*` now works with the data type. As noted in the doc, it now 
accepts 'any type'. So `collection_max` is equivalent to `maxwritetime`. 

{code:sql}
// code placeholder
cqlsh> SELECT a, d, collection_max(writetime(d)) FROM test.max_ts WHERE a = 2;

 a | d| system.collection_max(writetime(d))
---+--+-
 2 | {1: 1, 2: 2} |1669918636589727
{code}

What do you think about splitting into 2 patches? One to make `collection_*` 
functions to work with non-collections, and the other one to remove 
`maxwritetime`. This way it is a bit more clear in the changes. 

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
> Fix For: 4.2
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-11-30 Thread Jira


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

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

Thanks for the feedback.

In the latter example, the assumption is that the user knows the type of the 
column and will only use {{collection_max}} function when dealing with 
collections:
{code:java}
> CREATE TABLE test.max_ts ( a int PRIMARY KEY, b int, c list );
> INSERT INTO max_ts ( a, b, c ) VALUES ( 1, 1, [1, 2, 3] );
> SELECT a, b, c, writetime(b), collection_max(writetime(c)) FROM max_ts WHERE 
> a = 1;

 a | b | c | writetime(b) | system.collection_max(writetime(c))
---+---+---+--+-
 1 | 1 | [1, 2, 3] | 1669820977087840 |1669820977087840
{code}
But I guess we can also consider that applying collection functions to a not 
collection type is equivalent to applying them to a singleton collection. So, 
for example, collection_max(2) = collection_max([2]) = 2. I have added a commit 
to the PR that does exactly that:
||PR||CI||
|[trunk|https://github.com/apache/cassandra/pull/2032]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/2521/workflows/e15c8205-bbf8-45a8-bc0f-eceb8eec9fca]
 
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/2521/workflows/28c80583-3c80-4255-9a42-38344c8ca14b]|
 

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
> Fix For: 4.2
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-11-29 Thread Yifan Cai (Jira)


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

Yifan Cai commented on CASSANDRA-18078:
---

Generally, I agree that we should remove the redundant function. 
A nice property of 'maxwritetime' is that it works on both single cell and 
multi-cell column. So client does not need to check the column type before 
applying the function. 
I will check out if 'collection_max' does the same. 

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
> Fix For: 4.2
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-11-29 Thread Francisco Guerrero (Jira)


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

Francisco Guerrero commented on CASSANDRA-18078:


+1 from me. It looks good

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
> Fix For: 4.2
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_max(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_max(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-11-29 Thread Jira


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

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

CC [~yifanc] [~ frankgh] [~blerer]

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> CASSANDRA-17425 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-18078) Consider removing MAXWRITETIME function

2022-11-29 Thread Jira


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

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

Here is a patch showing how the removal of {{maxwritetime}} would look like:
||PR||CI||
|[trunk|https://github.com/apache/cassandra/pull/2032]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/2520/workflows/96c76fe9-95d4-4d4d-9a28-2fa8651b7abe]
 
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/2520/workflows/e19c0258-cd3c-4864-a103-187a2d0a81de]|

I have preserved the original test cases, even when they are also a bit 
redundant since we have separate tests for {{writetime}} and {{collection_max}}.

> Consider removing MAXWRITETIME function
> ---
>
> Key: CASSANDRA-18078
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18078
> Project: Cassandra
>  Issue Type: Improvement
>  Components: CQL/Syntax
>Reporter: Andres de la Peña
>Priority: Normal
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> CASSANDRA-17456 added a new {{MAXWRITETIME}} function that allows to retrieve 
> the maximum timestamp of a multi-cell column. For example:
> {code:java}
> > CREATE TABLE t (k int PRIMARY KEY, v set);
> > INSERT INTO t (k, v) VALUES (1, {1, 2}) USING TIMESTAMP 100;
> > UPDATE t USING TIMESTAMP 200 SET v += {3} WHERE k=1;
> > SELECT maxwritetime(v) FROM t;
>  maxwritetime(v)
> -
>  200
> {code}
> Later, CASSANDRA-8877 added the means to retrieve the write times and TTLs of 
> each of the cells in a multi-cell column:
> {code:java}
> > SELECT writetime(v) FROM t;
>  writetime(v)
> -
>  [100, 100, 200]
> > SELECT writetime(v[1]) FROM t;
>  writetime(v[1])
> -
>  100
> {code}
> Quite recently, CASSANDRA-18060 has added generic CQL functions to get the 
> min and max items in a collection. Those functions can be used in combination 
> with the classic {{writetime}} function to get the same results as the new 
> {{maxwritetime}} function:
> {code:java}
> > SELECT collection_max(writetime(v)) FROM t;
>  system.collection_max(writetime(v))
> -
>  200
> {code}
> Those new functions can also be used to get the min timestamp, or the min/max 
> TTL, for which there isn't a specific function:
> {code:java}
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_min(writetime(v)) FROM t;
> SELECT collection_avg(writetime(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_min(ttl(v)) FROM t;
> SELECT collection_avg(ttl(v)) FROM t;
> {code}
> I think this makes the new {{maxwritetime}} mostly redundant, since the new 
> functions can achieve the same results in a more generic way. Since the new 
> {{maxwritetime}} function is only on trunk, we should consider whether we 
> want to remove it in favour of the generic functions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org