You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Andres de la Peña (Jira)" <ji...@apache.org> on 2022/06/17 11:24:00 UTC

[jira] [Comment Edited] (CASSANDRA-17628) CQL writetime and ttl functions should be forbidden for multicell columns

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

Andres de la Peña edited comment on CASSANDRA-17628 at 6/17/22 11:23 AM:
-------------------------------------------------------------------------

The proposed patch modifies the validation rule so {{writetime}} and {{ttl}} functions can be used in frozen collections and UDTs, and it's disallowed in non-frozen collections and UDTs. CI is running:
||PR||CI||
|[3.0 |https://github.com/apache/cassandra/pull/1689]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1710/workflows/5032d34c-6814-4b48-b693-4555c0897ed1]|
|[3.11 |https://github.com/apache/cassandra/pull/1690]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1711/workflows/a5a46d02-051e-4211-8819-800fa1ae0ad3]|
|[4.0 |https://github.com/apache/cassandra/pull/1691]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1709/workflows/9d4dc479-e1c1-4698-8ddf-98fb4194ea0c] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1709/workflows/a4d71be0-cc5e-4614-92fd-8e6ae389131d]|
|[4.1 |https://github.com/apache/cassandra/pull/1692]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1713/workflows/902d8e2b-d387-4406-a39b-da53d81396cc] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1713/workflows/c9c4df7c-3f4a-4cd8-96b6-90cbd4981042]|
|[trunk|https://github.com/apache/cassandra/pull/1693]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1712/workflows/bd5be509-a885-41c2-b803-4d9ef2c30235] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1712/workflows/0b724b48-0b0c-4c65-9dbb-fea6c9e6a0a8]|


was (Author: adelapena):
The proposed patch modifies the validation rule so {{writetime}} and {{ttl}} functions can be used in frozen collections and UDTs, and it's disallowed in non-frozen collections and UDTs:
||PR||CI||
|[3.0 |https://github.com/apache/cassandra/pull/1689]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1710/workflows/5032d34c-6814-4b48-b693-4555c0897ed1]|
|[3.11 |https://github.com/apache/cassandra/pull/1690]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1711/workflows/a5a46d02-051e-4211-8819-800fa1ae0ad3]|
|[4.0 |https://github.com/apache/cassandra/pull/1691]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1709/workflows/9d4dc479-e1c1-4698-8ddf-98fb4194ea0c] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1709/workflows/a4d71be0-cc5e-4614-92fd-8e6ae389131d]|
|[4.1 |https://github.com/apache/cassandra/pull/1692]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1713/workflows/902d8e2b-d387-4406-a39b-da53d81396cc] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1713/workflows/c9c4df7c-3f4a-4cd8-96b6-90cbd4981042]|
|[trunk|https://github.com/apache/cassandra/pull/1693]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1712/workflows/bd5be509-a885-41c2-b803-4d9ef2c30235] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1712/workflows/0b724b48-0b0c-4c65-9dbb-fea6c9e6a0a8]|

> CQL writetime and ttl functions should be forbidden for multicell columns
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-17628
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17628
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Semantics
>            Reporter: Andres de la Peña
>            Assignee: Andres de la Peña
>            Priority: Normal
>             Fix For: 3.0.x, 3.11.x, 4.0.x, 4.1.x, 4.x
>
>
> CQL {{writetime}} and {{ttl}} functions are currently forbidden for collections, frozen or not. Also, they are always allowed for UDTs, frozen or not:
> {code}
> CREATE TYPE udt (a int, b int);
> CREATE TABLE t (k int PRIMARY KEY, s set<int>, fs frozen<set<int>>, t udt, ft frozen<udt>);
> SELECT writetime(s) FROM t; -- fails
> SELECT writetime(st) FROM t; -- fails
> SELECT writetime(t) FROM t; -- allowed
> SELECT writetime(ft) FROM t; -- allowed
> {code}
> This is done by checking in [{{Selectable.WritetimeOrTTL#newSelectorFactory}}|https://github.com/apache/cassandra/blob/cassandra-4.0.4/src/java/org/apache/cassandra/cql3/selection/Selectable.java#L250] whether the column is a collection or not. However, I think that what we should check is whether the column is multi-cell. That way the function would work with frozen collections and UDTs, and it would reject unfrozen collections and UDTs:
> {code}
> SELECT writetime(s) FROM t; -- fails
> SELECT writetime(st) FROM t; -- allowed
> SELECT writetime(t) FROM t; -- fails
> SELECT writetime(ft) FROM t; -- allowed
> {code} 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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