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

Nested selection of reversed collections fails

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete CommentsStart ReviewNeeds Committer
    XMLWordPrintableJSON

Details

    • Correctness - Unrecoverable Corruption / Loss
    • Normal
    • Normal
    • Fuzz Test
    • All
    • None
    • Hide

      unittests

      Show
      unittests

    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            masokol Maciej Sokol Assign to me
            dcapwell David Capwell
            Maciej Sokol

            Dates

              Created:
              Updated:

              Slack

                Issue deployment