cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tristan Seligmann <mithra...@mithrandi.net>
Subject Re: Create CF with composite column through CQL 3
Date Wed, 31 Oct 2012 17:47:05 GMT
On Wed, Oct 31, 2012 at 7:14 PM, Wei Zhu <wz1975@yahoo.com> wrote:
> 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?

The first component of the PRIMARY KEY (user_id) is the row key:

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

The rest of the components (friend_id, status, source) are part of the
column name:

>       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,

and the final component of of the column name is the "CQL-level" column name:

> org.apache.cassandra.db.marshal.UTF8Type)

In this case, it will be "created" or "lastupdated" as those are the
only columns not part of the PRIMARY KEY.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

Mime
View raw message