incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <>
Subject Re: Composite Column Question
Date Wed, 21 Dec 2011 10:47:19 GMT
On Wed, Dec 21, 2011 at 7:04 AM, Martin Arrowsmith
<> wrote:
> Dear Cassandra Experts,
> Are the number of composite attributes fixed for each column family ?
> I have been doing : "create column family MyCF with comparator =
> 'CompositeType(IntegerType, UTF8Type)'
> And this creates a composite { integer:string }
> Hector complains when I give a 3rd attribute.

If you use CompositeType(IntegerType, UTF8Type) as comparator, you
cannot add a column with a name that has 3 components, because the
comparator wouldn't know how to compare that 3rd component.

However, the comparator is fine with you adding columns whose
name doesn't have all of the specified components. In other words,
if you know in advance that you may need up to 3 attributes (and you
know their type), you can declare all them at first but only use
the first components on some column name if needed.

Now that's obviously a bit restrictive. In theory, it could be possible
to update the comparator definition from
  CompositeType(IntegerType, UTF8Type)
to say
  CompositeType(IntegerType, UTF8Type, UUIDType)
at a later time but it is not possible right now because C* doesn't
allow any change of comparator. We should (and may) allow such
valid change at some point in the future.

Now, there also exists a DynamicCompositeType, that don't put
any restrictions on the number and type of component it uses. The
reason I'm mentioning it only at the end however is that it is trickier
to use and have some overhead over CompositeType. I'm also
not sure how much support hector have for this comparator. I would
avoid using DynamicCompositeType unless you know that
CompositeType really doesn't work for you.


> If "unstatic" composite columns are possible, what would be the CLI command
> to create such a column family, and how can it be implemented ?
> Best wishes,
> Martin

View raw message