Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-10537

CONTAINS and CONTAINS KEY support for Lightweight Transactions

    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Antoine Rocheteau ROCHETEAU Antoine
              nemothekid Nimi Wariboko Jr.
              ROCHETEAU Antoine
              Benjamin Lerer, Berenguer Blasi
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 20m
                  3h 20m