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

Update for NOT operator for 5.1 What's new page

    XMLWordPrintableJSON

Details

    • Operability
    • Normal
    • All
    • None

    Description

      Below is a short summary of CASSANDRA-18584 that can be added to a What's new in 5.1 page when the time for that page comes.

      CQL NOT CONTAINS, NOT CONTAINS KEY, != for map entries
          
          Ability to use NOT operator in filters on lists, sets and maps.
          Requires ALLOW FILTERING.
          
          All those operators can be mixed: i.e. you can use
          multiple CONTAINS, NOT CONTAINS, CONTAINS KEY, NOT CONTAINS KEY
          in a single WHERE clause.
          
          CQL NOT IN operator
          Ability to use NOT IN restrictions in CQL WHERE clause.
          Can be used on any column with ALLOW FILTERING.
          
          Can be also used on clustering columns w/o ALLOW FILTERING.
          Multicolumn NOT IN restrictions are supported
          (e.g. (c1, c2) NOT IN ((1, 2), (3, 4))).
          
          NOT IN restrictions are implemented as slice restrictions, therefore
          they can be merged with other slice restrictions using <, >, <=, >=.
          Also multiple NOT IN restrictions can be merged together.
          
          Allow CQL equals / non-equals operators in more places
          Now that we implemented NOT IN, both equals and non-equals
          can be rewritten as slices.
          
          column != value ---> column NOT IN (value)
          column  = value ---> column >= value AND column <= value
          
          And because slices can be freely merged, this opens room for
          many interesting queries that were previously
          impossible, e.g.:
          
          SELECT ... WHERE c1 != ?
          SELECT ... WHERE c1 != ? AND c1 != ? AND ...
          SELECT ... WHERE c1 = ? AND (c1, c2) != (v1, v2)
          SELECT ... WHERE c1 IN ? AND (c1, c2) != (v1, v2)
          
          We adhere to the Three Valued Logic
      

      Of course the text can be tweaked but that is the TLDR, leaving it here so it does not get lost.
      The CQL docs were updated adding the new operators

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              e.dimitrova Ekaterina Dimitrova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: