cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timmy Turner <timm.t...@gmail.com>
Subject Re: Create CF with composite column through CQL 3
Date Wed, 31 Oct 2012 17:40:04 GMT
CQL3 handles columns/rows/keys differently than Cassandra itself
underneath. If you look closely you'll see that your real primary key
is in fact only a Long:

>       Key Validation Class: org.apache.cassandra.db.marshal.LongType

If you want to know more about it, check these 2 articles:

http://www.datastax.com/dev/blog/cql3-for-cassandra-experts
http://www.datastax.com/dev/blog/thrift-to-cql3
(Also note that there are differences in CQL3 between 1.1 an 1.2.)

This caused a bit of confusion for myself too a few days ago. It
should really be documented somewhere in the wiki (as a CQL upgrade
guide or something), not just be mentioned in the Datastax blog.

2012/10/31 Wei Zhu <wz1975@yahoo.com>:
> I try to use CQL3 to create CF with composite columns,
>
>  CREATE TABLE Friends (
>          ...     user_id bigint,
>          ...     friend_id bigint,
>          ...     status int,
>          ...     source int,
>          ...     created timestamp,
>          ...     lastupdated timestamp,
>          ...     PRIMARY KEY (user_id, friend_id, status, source)
>          ... );
>
>
> When I check it with cli, the composite type is a bit odd, why it's defined
> as Long, Int32, Int32, UTF8, is it supposed to be Long, Long, Int32, Int32?
> Did
> I do something wrong?
>
>  describe friends;
>     ColumnFamily: friends
>       Key Validation Class: org.apache.cassandra.db.marshal.LongType
>       Default column value validator:
> org.apache.cassandra.db.marshal.UTF8Type
>       Columns sorted by: org.apache.cassandra.db.marshal.CompositeType(
> org.apache.cassandra.db.marshal.LongType,
> org.apache.cassandra.db.marshal.Int32Type,
> 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
>
> Thanks.
> -Wei

Mime
View raw message