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

ROCHETEAU Antoine commented on CASSANDRA-10537:
-----------------------------------------------

Yes this would be great I think we are close :)

I rebase both repo, did a small update on the documentation (limited to the 
syntax of UPDATE/DELETE statement, I don't think it's relevant to provide more 
details or example related to this patch).

The autocompletion and related tests are up to date but unfortunately I'm not 
able to properly execute "test_cqlsh_completion" (probably a conflict with my 
OSX environment, i'm looking into it).

Finally, I add some assertion on the tests listed by [~blerer] but this may be 
not enough. We could add new tests similar to {{testWholeList,testWholeSet}} 
and {{testWholeMap}} to fully covered conditional delete statement on 
collection (and not only for CONTAINS operators) but I'm not sure this is 
really necessary.

> CONTAINS and CONTAINS KEY support for Lightweight Transactions
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-10537
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10537
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Legacy/CQL
>            Reporter: Nimi Wariboko Jr.
>            Assignee: ROCHETEAU Antoine
>            Priority: Normal
>              Labels: AdventCalendar2021, CQL, lhf
>             Fix For: 4.x
>
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> Conditional updates currently do not support CONTAINS and CONTAINS KEY 
> conditions. Queries such as 
> {{UPDATE mytable SET somefield = 4 WHERE pk = 'pkv' IF set_column CONTAINS 
> 5;}}
> are not possible.
> Would it also be possible to support the negation of these (ex. testing that 
> a value does not exist inside a set)?
> +Additional Information for newcomers:+
> Negation should not be supported as for the moment we do not support it 
> within restrictions either.
> One way to approch this bug is to use test driven development. You can modify 
> {{InsertUpdateIfConditionCollectionsTest}} to allow CONTAINS and CONTAINS KEY 
> operators and go through the different failures.
> The following changes will need to be done.
> * The {{columnCondition}} rule from the ANTLR {{Parser.g}} file should be 
> updated to accept {{containsOperator}}.
> * {{ColumnCondition.Raw#prepareTerms}} should be modified in the case where 
> the operator is a CONTAINS or CONTAINS KEY as the {{receiver}} is not the 
> collection but keys or values of the collection. Look at 
> {{SingleColumnRelation#makeCollectionReceiver}}.
> * {{ColumnCollection.MultiCellCollectionBound#valueAppliesTo}} will need to 
> be changed for {{Map}} and {{Set}} to process CONTAINS operators.  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to