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

Bret McGuire commented on CASSANDRA-19930:
------------------------------------------

Good news is that the =/!= enhancements don't require any additional operations 
here.  QueryBuilder already supports these via OngoingSelection.element() (for 
choosing what to select) or Relation.mapValue() (for comparisons in a where 
clause).  The change here is that C* 5.1 will now understand and eval the 
query.  For example, the following fails in Cassandra 5.0.0:
{noformat}
 [cqlsh 6.2.0 | Cassandra 5.0.0 | CQL spec 3.4.7 | Native protocol v5]
Use HELP for help.
cqlsh> CREATE KEYSPACE foo WITH REPLICATION = { 'class' : 'SimpleStrategy', 
'replication_factor' : 1 };
cqlsh> CREATE TABLE foo.bar (a int, b int, c list<int>, d set<int>, e map<int, 
int>, PRIMARY KEY (a, b));
cqlsh> INSERT INTO foo.bar (a, b, c, d, e) VALUES (1, 2, [1, 6], {2, 12}, {1: 
6});
cqlsh> INSERT INTO foo.bar (a, b, c, d, e) VALUES (1, 3, [3, 2], {6, 4}, {3: 
2});
cqlsh> INSERT INTO foo.bar (a, b, c, d, e) VALUES (1, 4, [1, 2], {2, 4}, {1: 
2});
cqlsh> INSERT INTO foo.bar (a, b, c, d, e) VALUES (2, 3, [3, 6], {6, 12}, {3: 
6});
cqlsh> select a from foo.bar where e[1] != 6;
InvalidRequest: Error from server: code=2200 [Invalid query] 
message="Unsupported "!=" relation: e[1] != 6"
cqlsh> select a from foo.bar where e[1] != 6 allow filtering;
InvalidRequest: Error from server: code=2200 [Invalid query] 
message="Unsupported "!=" relation: e[1] != 6"{noformat}
 

> Query builder support for NOT CQL syntax
> ----------------------------------------
>
>                 Key: CASSANDRA-19930
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19930
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Client/java-driver
>            Reporter: Bret McGuire
>            Assignee: Bret McGuire
>            Priority: Normal
>
> CEP-29 describes a CQL syntax enhancement to support the NOT keyword as a 
> negation operation for relations.  This change looks to be coming for 5.1 
> based on 
> [CASSANDRA-18584|https://issues.apache.org/jira/browse/CASSANDRA-18584] and 
> [this 
> commit|https://github.com/apache/cassandra/commit/e0074a31ef26adaebff6ac0657e4471fc805f93f].
>  
> We should add support for this construction to the query builder.



--
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

Reply via email to