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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: 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

        Hide
        jbellis Jonathan Ellis added a comment -

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

        Show
        jbellis Jonathan Ellis added a comment - cli interoperation with CQL3 CFs is not supported; see CASSANDRA-4377
        Hide
        mishravivek 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
        mishravivek 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?
        Hide
        jbellis 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
        jbellis 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
        mishravivek 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
        mishravivek 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
        brandon.williams 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 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
        mishravivek 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
        mishravivek 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

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development