Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-9362 Native protocol v5
  3. CASSANDRA-8779

Add type code to binary query parameters in QUERY messages

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Fix Version/s: 4.x
    • Component/s: Legacy/CQL
    • Labels:
    • Environment:

      Linux Mint 64-bit | ruby-driver 2.1 | java-driver 2.1 | C* 2.1.2

    • Impacts:
      Clients

      Description

      If I insert a tuple using an extra pair of ()'s, C* will let me do the insert, but (incorrectly) creates a nested tuple as the first tuple value. Upon doing a select statement, the result is jumbled and has weird binary in it (which I wasn't able to copy into here).

      Example using ruby-driver:

      session.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<tuple<ascii, bigint, boolean>>)")
      
      complete = Cassandra::Tuple.new('foo', 123, true)
      session.execute("INSERT INTO mytable (a, b) VALUES (0, (?))", arguments: [complete])            # extra ()'s here
      result = session.execute("SELECT b FROM mytable WHERE a=0").first
      p result['b']
      

      Output:

      #<Cassandra::Tuple:0x97b328 (fo{, , )>
      

      Bug also confirmed using java-driver.
      Example using java-driver:

      session.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<tuple<ascii, int, boolean>>)");
      
      TupleType t = TupleType.of(DataType.ascii(), DataType.cint(), DataType.cboolean());
      TupleValue complete = t.newValue("foo", 123, true);
      session.execute("INSERT INTO mytable (a, b) VALUES (0, (?))", complete); // extra ()'s here
      TupleValue r = session.execute("SELECT b FROM mytable WHERE a=0").one().getTupleValue("b");
      System.out.println(r);
      

      Output:

      ('foo{', null, null)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kishkaru Kishan Karunaratne
            • Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated: