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

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

    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

        1. image-2024-09-07-22-22-00-382.png
          35 kB
          Nikhil
        2. image-2024-09-07-22-20-38-433.png
          21 kB
          Nikhil
        3. image-2024-09-07-22-18-35-109.png
          25 kB
          Nikhil
        4. ci_summary.html
          84 kB
          Yifan Cai

        Issue Links

          Activity

            People

              rwelgosh Raymond Welgosh
              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