From user-return-30922-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Mon Jan 7 11:11:26 2013 Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB9E8DC18 for ; Mon, 7 Jan 2013 11:11:26 +0000 (UTC) Received: (qmail 81062 invoked by uid 500); 7 Jan 2013 11:11:24 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 81004 invoked by uid 500); 7 Jan 2013 11:11:23 -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 80517 invoked by uid 99); 7 Jan 2013 11:11:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 11:11:21 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.223.179] (HELO mail-ie0-f179.google.com) (209.85.223.179) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 11:11:15 +0000 Received: by mail-ie0-f179.google.com with SMTP id k14so23030150iea.38 for ; Mon, 07 Jan 2013 03:10:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mithrandi.net; s=google; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=IhMBTJhDNbr3VnlR2ZAsnVwAmLlT+yYa/6KmCQUS/aQ=; b=DBlsL0ZpKS620AFjS7r3xY8BEHnZiL26oo0B50CqRNVlBbAICZMALKu48Q8AHGXPto XYTRPhN3pw0RlfhV/caempCj/b86buXmf+YMN7C0IKIAVdgZ4SA6w9nv55mvDgyK2Vr0 i4snjhUsX9z7cn4mFv+URmda+d0XSVmUY8gZ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type:x-gm-message-state; bh=IhMBTJhDNbr3VnlR2ZAsnVwAmLlT+yYa/6KmCQUS/aQ=; b=d9uvYEG6GFYA9tGR+6iu8d/buoV9jpLvn9QXeYUrfC2l1HiBssXUdAJnr7FnTXL6oZ XZnA01oXynC7l4JWFq2wkxi7SPa5AJ6vnogvHslj8dHAGWYs+iUMd+0MmuDL4tjXs19u IXIZb0W2uCqHJu3EA6T22U1jltQ93vi0QbRNTuJeelhmX3upRbs8yvq9E+mBTGNNRZgA AHLCbsG29/uRCgROFqxV0t+GX/kqIpW5w5oIKBHCD2m3E9lVItZlC9/o7162q6Hk0w/e zO+HXb8CV4uvMVxPC1q4FQyaWgTRByW/PGpY1AzkWDN6jdAQJ7Xw7Zoi3c2AdvMm4SoB 76ng== MIME-Version: 1.0 X-Received: by 10.50.208.41 with SMTP id mb9mr5329177igc.42.1357557052899; Mon, 07 Jan 2013 03:10:52 -0800 (PST) Received: by 10.64.47.8 with HTTP; Mon, 7 Jan 2013 03:10:52 -0800 (PST) In-Reply-To: <013801cdeb5f$f676be50$e3643af0$@chalamet.net> References: <013801cdeb5f$f676be50$e3643af0$@chalamet.net> Date: Mon, 7 Jan 2013 13:10:52 +0200 Message-ID: Subject: Re: Cassandra 1.2 From: Tristan Seligmann To: user@cassandra.apache.org Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmlCroWxW+yTwdlWc5vqgXkE3flADu/+s5bIpoH67DzCySkYJ0HtNToQ6hlBaFskIgq5frk X-Virus-Checked: Checked by ClamAV on apache.org If you use PRIMARY KEY ((a, b)) instead of PRIMARY KEY (a, b), the partition key will be a composite of both the a and b values; with PRIMARY KEY (a, b), the partition key will be a, and the column names will be a composite of b and the column name (c being the only regular column here). I am guessing the strange results you get are a bug; Cassandra should either refuse to execute the query (this might make sense since there is no way to partially match on a partition key, other than by scanning all keys) or give the expected results. On Sat, Jan 5, 2013 at 6:16 PM, Pierre Chalamet wrote: > Hello, > > Removing the extra parenthesis around the primary key definition seems to > work as expected: > CREATE TABLE foo2 (a int, b text, c uuid, PRIMARY KEY (a, b) ); > INSERT INTO foo2 (a, b , c ) VALUES ( 1 , 'aze', > '4d481800-4c5f-11e1-82e0-3f484de45426'); > INSERT INTO foo2 (a, b , c ) VALUES ( 1 , 'ert', > '693f5800-8acb-11e3-82e0-3f484de45426'); > INSERT INTO foo2 (a, b , c ) VALUES ( 1 , 'opl', > 'd4815800-2d8d-11e0-82e0-3f484de45426'); > > localhost> select * from foo where a=1; > +---+-----+--------------------------------------+ > | a | b | c | > +===+=====+======================================+ > | 1 | ert | 693f5800-8acb-11e3-82e0-3f484de45426 | > +---+-----+--------------------------------------+ > | 1 | opl | d4815800-2d8d-11e0-82e0-3f484de45426 | > +---+-----+--------------------------------------+ > > localhost> select * from foo2 where a=1; > +---+-----+--------------------------------------+ > | a | b | c | > +===+=====+======================================+ > | 1 | aze | 4d481800-4c5f-11e1-82e0-3f484de45426 | > +---+-----+--------------------------------------+ > | 1 | ert | 693f5800-8acb-11e3-82e0-3f484de45426 | > +---+-----+--------------------------------------+ > | 1 | opl | d4815800-2d8d-11e0-82e0-3f484de45426 | > +---+-----+--------------------------------------+ > > Looks like there is something weird happening when creating the table. > > - Pierre > > -----Original Message----- > From: Kais Ahmed [mailto:kais@neteck-fr.com] > Sent: Saturday, January 05, 2013 2:30 PM > To: dev@cassandra.apache.org > Subject: Cassandra 1.2 > > Hi all, > > I create a table in cassandra 1.2, and makes two queries, the second query > gives me a false result, is this normal behavior? > > > ---------------------------------------------------------------------------- > ------------------------------------------ > [cqlsh 2.3.0 | Cassandra 1.2.0-SNAPSHOT | CQL spec 3.0.0 | Thrift protocol > 19.35.0] > > cqlsh:test> CREATE TABLE foo ( a int, b text, c uuid, PRIMARY KEY > ((a, b)) ); > > cqlsh:test> INSERT INTO foo (a, b , c ) VALUES ( 1 , 'aze', > '4d481800-4c5f-11e1-82e0-3f484de45426'); > cqlsh:test> INSERT INTO foo (a, b , c ) VALUES ( 1 , 'ert', > '693f5800-8acb-11e3-82e0-3f484de45426'); > cqlsh:test> INSERT INTO foo (a, b , c ) VALUES ( 1 , 'opl', > 'd4815800-2d8d-11e0-82e0-3f484de45426'); > > ---------------------------------------------------------------------------- > ------------------------------------------------------------------------- > > cqlsh:test> SELECT * FROM foo; > > a | b | c > ---+-----+-------------------------------------- > 1 | ert | 693f5800-8acb-11e3-82e0-3f484de45426 > 1 | opl | d4815800-2d8d-11e0-82e0-3f484de45426 > 1 | aze | 4d481800-4c5f-11e1-82e0-3f484de45426 > > ---------------------------------------------------------------------------- > ------------------------------------------------------------------------- > > cqlsh:test> SELECT * FROM foo where a=1; > > a | b | c > ---+-----+-------------------------------------- > 1 | ert | 693f5800-8acb-11e3-82e0-3f484de45426 > 1 | opl | d4815800-2d8d-11e0-82e0-3f484de45426 > -- mithrandi, i Ainil en-Balandor, a faer Ambar