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

Nested selection of reversed collections fails

    XMLWordPrintableJSON

Details

    Description

      The following test fails caused by the fact we make reversed a type that wraps the underline type

      @Test
          public void testMapsReversed() throws Throwable
          {
              createTable("CREATE TABLE %s (" +
                          "   k int, " +
                          "   c frozen<map<text, int>>, " +
                          "   v int, " +
                          "   PRIMARY KEY(k, c)" +
                          ") WITH CLUSTERING ORDER BY (c DESC)");
      
              execute("SELECT c['testing'] FROM %s");
          }
      

      With the error

      org.apache.cassandra.exceptions.InvalidRequestException: Invalid element selection: c is of type frozen<map<text, int>> is not a collection
      

      When you look in a debugger you see that the real type is ReversedType(MapType(…)), so the current checks fail.

      Additional information for newcomers:

      • The problem impact element selection as well as range selection that where introduced in CASSANDRA-7396 as part of 4.0. So the patch will need to be done for 4.0.
      • The checks that needs to be modified is in Selectable.WithElementSelection and Selectable.WithSliceSelection
      • The unit tests should be added to CollectionsTest

      Attachments

        Activity

          People

            masokol Maciej Sokol
            dcapwell David Capwell
            Maciej Sokol
            Votes:
            0 Vote for this issue
            Watchers:
            5 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 - 1h 20m
                1h 20m