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/05/16 10:17:00 UTC

[jira] [Updated] (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:all-tabpanel ]

Andres de la Peña updated CASSANDRA-17628:
------------------------------------------
    Component/s: CQL/Semantics

> 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
>            Priority: Normal
>
> 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