Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 5568 invoked from network); 2 Feb 2011 11:23:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Feb 2011 11:23:10 -0000 Received: (qmail 51918 invoked by uid 500); 2 Feb 2011 11:23:08 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 51535 invoked by uid 500); 2 Feb 2011 11:23:04 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 51525 invoked by uid 99); 2 Feb 2011 11:23:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 11:23:03 +0000 X-ASF-Spam-Status: No, hits=3.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ertiop93@gmail.com designates 209.85.216.194 as permitted sender) Received: from [209.85.216.194] (HELO mail-qy0-f194.google.com) (209.85.216.194) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 11:22:57 +0000 Received: by qyk4 with SMTP id 4so978243qyk.1 for ; Wed, 02 Feb 2011 03:22:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=uX2CncTOhEs1MjfxqQKxGUjF2mS5YXQvHQrpjKi1mB8=; b=LKYudyTXtYQtnchInxw5iJh0SPUrKhVG3F2rEGGQJAa+VZM5OyLtFo0JMccxqLeJ2M UYC3J71FSnoSLj5UTM6L1jWfFfYckNb1eBj1ETmtPEIixTOz8Bsk0HJp9oRA0xaQpdXx MMXPiYZLH32LMeymFt3AFmna4RBOWLrZKThaw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Gi4dy5NE13G5EQ8tvFQdzAL8pSxV68wR4LhY0qNoShiGBmvnbolgQ02PESjh03BbVk eTSB+Rl2BxPQv72NWk/ZeoOJMXWZwmcyFGdcOMtCl1yV5P1qILE9ZvgzxTNpK8rlP6I0 UCS6LqRuhdqRyb0Gd266a4XQIH5SNBMDoujzg= MIME-Version: 1.0 Received: by 10.224.2.199 with SMTP id 7mr8520480qak.330.1296645756050; Wed, 02 Feb 2011 03:22:36 -0800 (PST) Received: by 10.224.193.136 with HTTP; Wed, 2 Feb 2011 03:22:36 -0800 (PST) In-Reply-To: References: Date: Wed, 2 Feb 2011 16:52:36 +0530 Message-ID: Subject: Re: Can a same key exists for two rows in two different column families without clashing ? From: Ertio Lew To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0015175cb870b05ef3049b4add1d --0015175cb870b05ef3049b4add1d Content-Type: text/plain; charset=ISO-8859-1 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 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> columnFamily1; > > public final Map> columnFamily2; > > public final Map>> > 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 > --0015175cb870b05ef3049b4add1d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Stephen for the Great Explanation!



On Wed, Feb 2, 2011 at 4:31 PM, Stephen Connolly <stephen.alan.connol= ly@gmail.com> wrote:
<= div class=3D"h5">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 wi= thout
> clashing ?=A0 Other words, does the same algorithm needs to enforced f= or
> 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 a= ny
> problems associated with this.
>
> Thanks.
> Ertio Lew
>

it is a bad analogy for many reasons but if you replace "r= ow 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 {

=A0public final Map<String,Map<String,byte[]>> columnFamily1;<= br>
=A0public final Map<String,Map<String,byte[]>> columnFamily2;<= br>
=A0public final Map<String,Map<String,Map<String,byte[]>>&g= t; superColumnFamily3;

}

(still not quite correct, but mostly so for our purposes);

you are asking given

Keyspace keyspace;
String key1 =3D makeKeyAlg1();
keyspace.columnFamily1.put(key1,...);

String key2 =3D makeKeyAlg2();
keyspace.columnFamily2.put(key2,...);

when key1.equals(key2)

then is there a problem?

They are two separate maps... why would there be.

-Stephen

--0015175cb870b05ef3049b4add1d--