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

UDT rejects UDT literals when the column is clustering and reverse order

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • 5.x
    • CQL/Semantics
    • None
    • Correctness - API / Semantic Implementation
    • Critical
    • Low Hanging Fruit
    • Fuzz Test
    • All
    • None

    Description

      This was found in Accord’s fuzz testing

      CREATE TYPE distributed_test_keyspace."EJfW0z8VJlcU2PA1sfV_mTu2jEFmRZbvzg2P1sW0EUBl" (
          "kRT76zGo0XlD_FXMcjR5scASR4W_WtKw3WxPrMeosltr6X" set<'org.apache.cassandra.db.marshal.LexicalUUIDType’>
      );
      
      CREATE TABLE distributed_test_keyspace."vTZ11fk6t8tzR3V" (
          "X2RD2YtsnBd7mvidw" frozen<tuple<frozen<"egCMwY5Ivz1Ubq5rtTKGaMSb4MtO0BVBAs8CEpqM">>>,
          "yXEL6XVkYSEWoFb8HTj0JAXx2pPtFlMNIa9l7H" frozen<"EJfW0z8VJlcU2PA1sfV_mTu2jEFmRZbvzg2P1sW0EUBl">,
          "bBsAIZg0d6ed_VyEYmo7XKdZhWLGSF5AaZCcIIv0A8N8kkjMp" 'org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.FrozenType(org.apache.cassandra.db.marshal.UserType(distributed_test_keyspace,5337794750306e6c,6f506464446c3762575652615a7a59397866345f4e6163764c4c634575:org.apache.cassandra.db.marshal.BytesType,777a526a4b7775706453384465546f7957474552564f456771527052596e4c36614f4d4e58596439336a6470:org.apache.cassandra.db.marshal.UTF8Type)),org.apache.cassandra.db.marshal.FrozenType(org.apache.cassandra.db.marshal.SetType(org.apache.cassandra.db.marshal.InetAddressType)))',
          "qokh6bGEIF4xf5AAZn6jMc" 'org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.ListType(org.apache.cassandra.db.marshal.Int32Type),org.apache.cassandra.db.marshal.FloatType)' static,
          "UGwI2I3HjxYOCA" 'org.apache.cassandra.db.marshal.LexicalUUIDType',
          PRIMARY KEY ("X2RD2YtsnBd7mvidw", "yXEL6XVkYSEWoFb8HTj0JAXx2pPtFlMNIa9l7H", "bBsAIZg0d6ed_VyEYmo7XKdZhWLGSF5AaZCcIIv0A8N8kkjMp")
      ) WITH CLUSTERING ORDER BY ("yXEL6XVkYSEWoFb8HTj0JAXx2pPtFlMNIa9l7H" DESC, "bBsAIZg0d6ed_VyEYmo7XKdZhWLGSF5AaZCcIIv0A8N8kkjMp" ASC)
      
      UPDATE distributed_test_keyspace."vTZ11fk6t8tzR3V"
        SET 
            "qokh6bGEIF4xf5AAZn6jMc"=?, 
            "UGwI2I3HjxYOCA"=QtGwDS."UGwI2I3HjxYOCA"
        WHERE 
          "X2RD2YtsnBd7mvidw"=? AND 
          "yXEL6XVkYSEWoFb8HTj0JAXx2pPtFlMNIa9l7H"={"kRT76zGo0XlD_FXMcjR5scASR4W_WtKw3WxPrMeosltr6X": {0x0000000000001f00bd00000000000000}} AND 
          "bBsAIZg0d6ed_VyEYmo7XKdZhWLGSF5AaZCcIIv0A8N8kkjMp"=0x...;
      
      ERROR [node2_isolatedExecutor:3] node2 2024-07-17 14:04:33,530 JVMStabilityInspector.java:71 - Exception in thread Thread[node2_isolatedExecutor:3,5,isolatedExecutor]
      org.apache.cassandra.exceptions.InvalidRequestException: Invalid user type literal for yXEL6XVkYSEWoFb8HTj0JAXx2pPtFlMNIa9l7H of type frozen<"EJfW0z8VJlcU2PA1sfV_mTu2jEFmRZbvzg2P1sW0EUBl">
      	at org.apache.cassandra.cql3.terms.UserTypes$Literal.validateAssignableTo(UserTypes.java:175)
      	at org.apache.cassandra.cql3.terms.UserTypes$Literal.prepare(UserTypes.java:137)
      	at org.apache.cassandra.cql3.terms.Terms$Raw$2.prepare(Terms.java:280)
      	at org.apache.cassandra.cql3.Relation.toRestriction(Relation.java:178)
      	at org.apache.cassandra.cql3.restrictions.StatementRestrictions.<init>(StatementRestrictions.java:218)
      	at org.apache.cassandra.cql3.restrictions.StatementRestrictions.<init>(StatementRestrictions.java:157)
      	at org.apache.cassandra.cql3.statements.ModificationStatement$Parsed.newRestrictions(ModificationStatement.java:1162)
      	at org.apache.cassandra.cql3.statements.UpdateStatement$ParsedUpdate.prepareInternal(UpdateStatement.java:423)
      	at org.apache.cassandra.cql3.statements.ModificationStatement$Parsed.prepare(ModificationStatement.java:1076)
      	at org.apache.cassandra.cql3.statements.TransactionStatement$Parsed.prepare(TransactionStatement.java:566)
      	at org.apache.cassandra.distributed.test.accord.AccordTestBase.lambda$isIdempotent$3b31f888$1(AccordTestBase.java:399)
      

      The issue is “yXEL6XVkYSEWoFb8HTj0JAXx2pPtFlMNIa9l7H” is ReverseType (ORDER BY DESC), so type.isUDT() returns false!

      Attachments

        Activity

          People

            Unassigned Unassigned
            dcapwell David Capwell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: