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

type system contains check for duration does not work for hidden types

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 5.1
    • CQL/Interpreter
    • None
    • Correctness - Unrecoverable Corruption / Loss
    • Critical
    • Low Hanging Fruit
    • Fuzz Test
    • All
    • None
    • Hide

      Added tests in AbstractTypeTest.java to check nested types with durations in them. 

      Show
      Added tests in AbstractTypeTest.java to check nested types with durations in them. 

    Description

      The function "org.apache.cassandra.db.marshal.AbstractType#referencesDuration” relies on type overriding for detecting if the type contains a duration, but the hidden types like Composite or DynamicComposite don’t override this… this means that we will be able to create a 2i index for these columns (unless we use SAI as it properly detects this)

      CREATE TABLE "tbl" (
          "pk1" int,
          "with_duration" 'CompositeType(ListType(DurationType))',
          PRIMARY KEY ("pk1")
      );
      CREATE INDEX ON "tbl"("with_duration");
      

      This is able to create the 2i index even though we shouldn’t be able to due to duration not being allowed in indexes.

      We have a test method that is able to detect if a type exists in complex types:

      AbstractTypeGenerators.contains(type, DurationType.instance);
      

      Could leverage the same logic to avoid maintenance burden with inheritance

      Attachments

        Issue Links

        Activity

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

          People

            rwelgosh Raymond Welgosh Assign to me
            dcapwell David Capwell
            Raymond Welgosh
            David Capwell, Yifan Cai
            Votes:
            0 Vote for this issue
            Watchers:
            4 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 50m
                1h 50m

                Slack

                  Issue deployment