[
https://issues.apache.org/jira/browse/CASSANDRA-15266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17499476#comment-17499476
]
Andres de la Peña edited comment on CASSANDRA-15266 at 3/1/22, 11:52 AM:
-------------------------------------------------------------------------
Thanks for the PR, I think they are not mandatory but I find them very useful.
Overall the changes look good to me, I have left a couple of minor comments. CI
is looking good too.
was (Author: adelapena):
Thanks for the PR, I think they are not mandatory but I found them very useful.
Overall the changes look good to me, I have left a couple of minor comments.
> java internal exception on attempt to UPDATE a row using CONTAINS operator
> --------------------------------------------------------------------------
>
> Key: CASSANDRA-15266
> URL: https://issues.apache.org/jira/browse/CASSANDRA-15266
> Project: Cassandra
> Issue Type: Bug
> Components: Legacy/CQL
> Reporter: Konstantin
> Assignee: Maciej Sokol
> Priority: Normal
> Labels: lhf
> Fix For: 3.0.x, 3.11.x, 4.0.x
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> kostja@atlas ~ % cqlsh -ucassandra -pcassandra
> Connected to My Cluster at 127.0.0.1:9042.
> [cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]
> Use HELP for help.
> cassandra@cqlsh> CREATE KEYSPACE t1 WITH replication =
> \{'class':'SimpleStrategy', 'replication_factor' : 1};
> cassandra@cqlsh> use t1;
> cassandra@cqlsh:t1> create table t (a int, b frozen<map<int, int>>, c int,
> primary key (a, b));
> cassandra@cqlsh:t1> insert into t (a, b, c) values (1, \{1:1, 2:2}, 3);
> cassandra@cqlsh:t1> update t set c=3 where a=1 and b contains 1;
> ServerError: java.lang.UnsupportedOperationException
>
> Server log file:
> ```
> ERROR [Native-Transport-Requests-1] 2019-08-07 17:02:59,283
> QueryMessage.java:129 - Unexpected error during query
> java.lang.UnsupportedOperationException: null
> at
> org.apache.cassandra.cql3.restrictions.SingleColumnRestriction$ContainsRestriction.appendTo(SingleColumnRestriction.java:454)
> ~[a
> pache-cassandra-3.11.4.jar:3.11.4]
> at
> org.apache.cassandra.cql3.restrictions.ClusteringColumnRestrictions.valuesAsClustering(ClusteringColumnRestrictions.java:109)
> ~[a
> pache-cassandra-3.11.4.jar:3.11.4]
> at
> org.apache.cassandra.cql3.restrictions.StatementRestrictions.getClusteringColumns(StatementRestrictions.java:770)
> ~[apache-cassan
> dra-3.11.4.jar:3.11.4]
> at
> org.apache.cassandra.cql3.statements.ModificationStatement.createClustering(ModificationStatement.java:312)
> ~[apache-cassandra-3.
> 11.4.jar:3.11.4]
> at
> org.apache.cassandra.cql3.statements.ModificationStatement.addUpdates(ModificationStatement.java:677)
> ~[apache-cassandra-3.11.4.j
> ar:3.11.4]
> at
> org.apache.cassandra.cql3.statements.ModificationStatement.getMutations(ModificationStatement.java:635)
> ~[apache-cassandra-3.11.4
> .jar:3.11.4]
> at
> org.apache.cassandra.cql3.statements.ModificationStatement.executeWithoutCondition(ModificationStatement.java:437)
> ~[apache-cassa
> ndra-3.11.4.jar:3.11.4]
> at
> org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:425)
> ~[apache-cassandra-3.11.4.jar:
> 3.11.4]
> at
> org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:225)
> ~[apache-cassandra-3.11.4.jar:3.11.4]
> at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:256)
> ~[apache-cassandra-3.11.4.jar:3.11.4]
> at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:241)
> ~[apache-cassandra-3.11.4.jar:3.11.4]
> at
> org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116)
> ~[apache-cassandra-3.11.4.jar:3.11.4]
> at
> org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:566)
> [apache-cassandra-3.11.4.jar:3.11.4]
> at
> org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410)
> [apache-cassandra-3.11.4.jar:3.11.4]
> at
> io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
> [netty-all-4.0.44.Final.jar:4.0.44
> ...
> ```
> +Additional information for newcomers:+
> {{CONTAINS}} and {{CONTAINS KEY}} restrictions are not supported for
> {{UPDATE}} or {{DELETE}} operations but they should be properly rejected with
> a proper error message.
> To fix that problem a new check should be added in the
> {{StatementRestrictions}} constructor to thrown an
> {{InvalidRequestException}} if the relation operator is a {{CONTAINS}} or
> {{CONTAINS_KEY}} and the {{StatementType}} an {{UPDATE}} or a {{DELETION}}.
> Some unit tests should be added to {{UpdateTest}} an {{DeleteTest}} to test
> the behavior.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]