incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ertio Lew <ertio...@gmail.com>
Subject Re: Can a same key exists for two rows in two different column families without clashing ?
Date Wed, 02 Feb 2011 11:22:36 GMT
Thanks Stephen for the Great Explanation!



On Wed, Feb 2, 2011 at 4:31 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> On 2 February 2011 10:03, Ertio Lew <ertiop93@gmail.com> wrote:
> > Can a same key exists for two rows in two different column families
> without
> > clashing ?  Other words, does the same algorithm needs to enforced for
> > generating keys for different column families or can different
> > algorithms(for generating keys) be enforced on column family basis?
> >
> > I have tried out that they can, but I wanted to know if there may be any
> > problems associated with this.
> >
> > Thanks.
> > Ertio Lew
> >
>
> it is a bad analogy for many reasons but if you replace "row key" with
> "primary key" and "column family" with "table" then you might get an
> answer.
>
> a better analogy is to think of the following.
>
> public class Keyspace {
>
>  public final Map<String,Map<String,byte[]>> columnFamily1;
>
>  public final Map<String,Map<String,byte[]>> columnFamily2;
>
>  public final Map<String,Map<String,Map<String,byte[]>>>
> superColumnFamily3;
>
> }
>
> (still not quite correct, but mostly so for our purposes);
>
> you are asking given
>
> Keyspace keyspace;
> String key1 = makeKeyAlg1();
> keyspace.columnFamily1.put(key1,...);
>
> String key2 = makeKeyAlg2();
> keyspace.columnFamily2.put(key2,...);
>
> when key1.equals(key2)
>
> then is there a problem?
>
> They are two separate maps... why would there be.
>
> -Stephen
>

Mime
View raw message