Cassandra
  1. Cassandra
  2. CASSANDRA-4779

Boolean type of composite column of compound primary key converted into UTF8Type

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Not a Problem
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Steps to reproduce:
      1) connect to cqlsh --cql3
      2) create keyspace testcomp;
      3) CREATE TABLE altercations (
      instigator text,
      started_at timestamp,
      ships_destroyed int,
      energy_used float,
      alliance_involvement boolean,
      PRIMARY KEY (instigator,started_at,ships_destroyed)
      4) INSERT INTO altercations (instigator, started_at, ships_destroyed,
      energy_used, alliance_involvement)
      VALUES ('Jayne Cobb', '2012-07-24', 2, 4.6, 'false');
      5) select * from altercations; gives output:
      instigator | started_at | ships_destroyed | alliance_involvement | energy_used
      ----------------------------------------------------------------------------------
      Jayne Cobb | 2012-07-23 00:00:00+0000 | 2 | False | 4.6

      But when try to connect via cassandra-cli and execute:

      6)list altercations; (output gives an error as below):
      Using default limit of 100
      Using default column limit of 100
      -------------------
      RowKey: Jayne Cobb
      => (column=2012-07-23 00:00:00+0530:2:alliance_involvement, value=, timestamp=1349772570037000)
      invalid UTF8 bytes 40933333

      gives me

      {invalid UTF8 bytes 40933333}

      Keyspace description:
      Keyspace: testcomp:
      Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
      Durable Writes: true
      Options: [datacenter1:1]
      Column Families:
      ColumnFamily: altercations
      Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
      Default column value validator: org.apache.cassandra.db.marshal.UTF8Type
      Columns sorted by: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 0.1
      DC Local Read repair chance: 0.0
      Replicate on write: true
      Caching: KEYS_ONLY
      Bloom Filter FP chance: default
      Built indexes: []
      Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
      Compression Options:
      sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor

      Issue:
      org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)

      Although alliance_involvement is of "boolean" data type! which is causing this issue.

      Looks like an issue with CompositeType creation, somehow boolean is also treated as UTF8Type.

        Activity

        Gavin made changes -
        Workflow patch-available, re-open possible [ 12753262 ] reopen-resolved, no closed status, patch-avail, testing [ 12758667 ]
        Gavin made changes -
        Workflow no-reopen-closed, patch-avail [ 12728873 ] patch-available, re-open possible [ 12753262 ]
        Hide
        Vivek Mishra added a comment -

        Thanks Brandon and Jonathan. I have already gone through https://issues.apache.org/jira/browse/CASSANDRA-4377 and Brian's blog as well. Looks like i did miss some last conversation on 4377 earlier.

        Cheers,
        -Vivek

        Show
        Vivek Mishra added a comment - Thanks Brandon and Jonathan. I have already gone through https://issues.apache.org/jira/browse/CASSANDRA-4377 and Brian's blog as well. Looks like i did miss some last conversation on 4377 earlier. Cheers, -Vivek
        Hide
        Brandon Williams added a comment -

        You are. Please see CASSANDRA-4377 if you want all the details, but Jonathan's original summary is all you really need to know. Mixing a non-cql client (cassandra-cli) with a CQL3 CF is not supported.

        Show
        Brandon Williams added a comment - You are. Please see CASSANDRA-4377 if you want all the details, but Jonathan's original summary is all you really need to know. Mixing a non-cql client (cassandra-cli) with a CQL3 CF is not supported.
        Hide
        Vivek Mishra added a comment -

        CompositeType:
        org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type).
        This is what i can see is CompositeType. For boolean composite column it is displayed as "UTF8Type"(see last one).

        I hope, am making myself clear.

        -Vivek

        Show
        Vivek Mishra added a comment - CompositeType: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type). This is what i can see is CompositeType. For boolean composite column it is displayed as "UTF8Type"(see last one). I hope, am making myself clear. -Vivek
        Hide
        Jonathan Ellis added a comment -

        Neither, it will be CompositeType.

        If you absolutely must mess with CQL definitions from (non-CQL) Thrift, Brian O'Neill has blogged an example: http://brianoneill.blogspot.com/2012/10/cql-astyanax-and-compoundcomposite-keys.html

        Show
        Jonathan Ellis added a comment - Neither, it will be CompositeType. If you absolutely must mess with CQL definitions from (non-CQL) Thrift, Brian O'Neill has blogged an example: http://brianoneill.blogspot.com/2012/10/cql-astyanax-and-compoundcomposite-keys.html
        Hide
        Vivek Mishra added a comment -

        So if a column family created via cql client with one composite column of boolean type, It's metadata will be of BooleanType or UTF8Type?

        Show
        Vivek Mishra added a comment - So if a column family created via cql client with one composite column of boolean type, It's metadata will be of BooleanType or UTF8Type?
        Jonathan Ellis made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Not A Problem [ 8 ]
        Hide
        Jonathan Ellis added a comment -

        cli interoperation with CQL3 CFs is not supported; see CASSANDRA-4377

        Show
        Jonathan Ellis added a comment - cli interoperation with CQL3 CFs is not supported; see CASSANDRA-4377
        Vivek Mishra made changes -
        Field Original Value New Value
        Description Steps to reproduce:
        1) connect to cqlsh --cql3
        2) create keyspace testcomp;
        3) CREATE TABLE altercations (
               instigator text,
               started_at timestamp,
               ships_destroyed int,
               energy_used float,
               alliance_involvement boolean,
               PRIMARY KEY (instigator,started_at,ships_destroyed)
        4) INSERT INTO altercations (instigator, started_at, ships_destroyed,
                                     energy_used, alliance_involvement)
                             VALUES ('Jayne Cobb', '2012-07-24', 2, 4.6, 'false');
        5) select * from altercations; gives output:
         instigator | started_at | ships_destroyed | alliance_involvement | energy_used
        ------------+--------------------------+-----------------+----------------------+-------------
         Jayne Cobb | 2012-07-23 00:00:00+0000 | 2 | False | 4.6

        But when try to connect via cassandra-cli and execute:

        6)list altercations; (output gives an error as below):
        Using default limit of 100
        Using default column limit of 100
        -------------------
        RowKey: Jayne Cobb
        => (column=2012-07-23 00:00:00+0530:2:alliance_involvement, value=, timestamp=1349772570037000)
        invalid UTF8 bytes 40933333

        gives me {invalid UTF8 bytes 40933333}

        Keyspace description:
        Keyspace: testcomp:
          Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
          Durable Writes: true
            Options: [datacenter1:1]
          Column Families:
            ColumnFamily: altercations
              Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
              Default column value validator: org.apache.cassandra.db.marshal.UTF8Type
              Columns sorted by: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)
              GC grace seconds: 864000
              Compaction min/max thresholds: 4/32
              Read repair chance: 0.1
              DC Local Read repair chance: 0.0
              Replicate on write: true
              Caching: KEYS_ONLY
              Bloom Filter FP chance: default
              Built indexes: []
              Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
              Compression Options:
                sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor


        Issue:
        org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)

        Although alliance_involvement is of "boolean" data type! which is causing this issue.

        Looks like an issue with CompositeType creation, somehow boolean is also treated as UTF8Type.


        Steps to reproduce:
        1) connect to cqlsh --cql3
        2) create keyspace testcomp;
        3) CREATE TABLE altercations (
               instigator text,
               started_at timestamp,
               ships_destroyed int,
               energy_used float,
               alliance_involvement boolean,
               PRIMARY KEY (instigator,started_at,ships_destroyed)
        4) INSERT INTO altercations (instigator, started_at, ships_destroyed,
                                     energy_used, alliance_involvement)
                             VALUES ('Jayne Cobb', '2012-07-24', 2, 4.6, 'false');
        5) select * from altercations; gives output:
         instigator | started_at | ships_destroyed | alliance_involvement | energy_used
        ------------+--------------------------+-----------------+----------------------+-------------
         Jayne Cobb | 2012-07-23 00:00:00+0000 | 2 | False | 4.6

        But when try to connect via cassandra-cli and execute:
         
        6)list altercations; (output gives an error as below):
        Using default limit of 100
        Using default column limit of 100
        -------------------
        RowKey: Jayne Cobb
        => (column=2012-07-23 00:00:00+0530:2:alliance_involvement, value=, timestamp=1349772570037000)
        invalid UTF8 bytes 40933333

        gives me {invalid UTF8 bytes 40933333}

        Keyspace description:
        Keyspace: testcomp:
          Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
          Durable Writes: true
            Options: [datacenter1:1]
          Column Families:
            ColumnFamily: altercations
              Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
              Default column value validator: org.apache.cassandra.db.marshal.UTF8Type
              Columns sorted by: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)
              GC grace seconds: 864000
              Compaction min/max thresholds: 4/32
              Read repair chance: 0.1
              DC Local Read repair chance: 0.0
              Replicate on write: true
              Caching: KEYS_ONLY
              Bloom Filter FP chance: default
              Built indexes: []
              Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
              Compression Options:
                sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor


        Issue:
        org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)

        Although alliance_involvement is of "boolean" data type! which is causing this issue.

        Looks like an issue with CompositeType creation, somehow boolean is also treated as UTF8Type.


        Vivek Mishra created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Vivek Mishra
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development