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 4FF4B9FA7 for ; Mon, 18 Jun 2012 02:25:37 +0000 (UTC) Received: (qmail 56121 invoked by uid 500); 18 Jun 2012 02:25:35 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 56088 invoked by uid 500); 18 Jun 2012 02:25:35 -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 56077 invoked by uid 99); 18 Jun 2012 02:25:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2012 02:25:34 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a51.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2012 02:25:29 +0000 Received: from homiemail-a51.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a51.g.dreamhost.com (Postfix) with ESMTP id 629592E805C for ; Sun, 17 Jun 2012 19:25:08 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=thelastpickle.com; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; q=dns; s=thelastpickle.com; b=cezVOqHiIW jtCB/QVSV4HLPdpr66NVibMp+nsCZn9a/bVvWoIkS2c1qBDHXuWlNQXSvkVXyI9k gGjUbVqFaftXxdK88fTX9CPZK8aUuUzcs/EW/yp+pWIIioUZ3yIlSO/71D++D6yv UYjJFvba2LrDe4/oEt84TeMYYhLlumves= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; s=thelastpickle.com; bh=bLZZLiZxmSuggIa5 035RmE38jqk=; b=WSeokyGaMvw4izthSL2k1dx7CDSjsEdxS4ZUVR88UOFibOdl uJY9eH4M2/yOpo6FGV3304eYx+mq+WbyZMZ1n18rv8uabSz3YTTef373D/qhzsVS Bw+HKXbz6Y9KUZnjeo4iqXEU4cb5C2y6j7leKd7eDZjQIYWfTxi/fG7s7n8= Received: from [172.20.10.3] (unknown [118.149.36.200]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a51.g.dreamhost.com (Postfix) with ESMTPSA id 6347E2E8058 for ; Sun, 17 Jun 2012 19:25:06 -0700 (PDT) From: aaron morton Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/alternative; boundary="Apple-Mail=_9151EE71-753C-4E4D-9B88-F1E70F93B0D0" Subject: Re: cql 3 qualification failing? Date: Mon, 18 Jun 2012 14:25:02 +1200 In-Reply-To: To: user@cassandra.apache.org References: Message-Id: X-Mailer: Apple Mail (2.1278) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_9151EE71-753C-4E4D-9B88-F1E70F93B0D0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 > So, my main primary key is on the ac_c column, text, and > the secondary composite key is on ac_creation, which is a date. These > queries perform correctly: In your CF there is only one primary key (aka row key), it is a = composite of ac_c and ac_creation. > select * from at_event_ac_c where ac_c =3D '1234' and ac_creation > > '2012-07-15' and ac_creation < '2012-07-18' > and ev_sev =3D 2; See=20 "WHERE clauses can include greater-than and less-than comparisons on = columns other than the first. As long as all previous key-component = columns have already been identified with strict =3D comparisons, the = last given key component column can be any sort of comparison."=20 http://www.datastax.com/docs/1.1/references/cql/SELECT You need to specify both the ac_c and ac_creation values using equality, = or specify neither.=20 Hope that helps.=20 ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com On 15/06/2012, at 5:04 AM, Greg Fausak wrote: > I have playing around with composite CFs, I have one declared: >=20 > create columnfamily > at_event_ac_c > ( > ac_event_id int, > ac_creation timestamp, > ac_action text, > ac_addr text, > ac_advisory_id text, > ac_c text, > ... > ev_sev text, > ... > ev_total text, > ev_url text, > ev_used text, > toast text, > fw text, > name text, > resp text, > size text, > PRIMARY KEY (ac_c, ac_creation) > ) with compression_parameters:sstable_compression =3D ''; >=20 > So, my main primary key is on the ac_c column, text, and > the secondary composite key is on ac_creation, which is a date. These > queries perform correctly: >=20 > select * from at_event_ac_c where ac_c =3D '1234'; >=20 > select * from at_event_ac_c where ac_c =3D '1234' and ac_creation > > '2012-07-15' and ac_creation < '2012-07-18'; >=20 > What's weird is I can't qualify on a non-indexed column, like: >=20 > select * from at_event_ac_c where ac_c =3D '1234' and ac_creation > > '2012-07-15' and ac_creation < '2012-07-18' > and ev_sev =3D 2; >=20 > I get an error: > Bad Request: No indexed columns present in by-columns clause with = Equal operator >=20 > But, I just attended a class on this. I thought that once I used my > indices the remaining qualifications would be satisfied via a = filtering > method. Obviously this is incorrect. Is there a way to 'filter' = results? >=20 > -g --Apple-Mail=_9151EE71-753C-4E4D-9B88-F1E70F93B0D0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1
So, my main primary key is on the ac_c = column, text, and
the secondary composite key is on ac_creation, = which is a date.  These
queries perform = correctly:
In your CF there is only one primary key = (aka row key), it is a composite of ac_c and = ac_creation.

select * = from at_event_ac_c where ac_c =3D '1234' and ac_creation = >
'2012-07-15' and ac_creation < = '2012-07-18'
  and ev_sev =3D = 2;

See 
"WHERE clauses = can include greater-than and less-than comparisons on columns other than = the first. As long as all previous key-component columns = have already been identified with strict =3D comparisons, the last = given key component column can be any sort of = comparison." 

= You need to specify both the ac_c and ac_creation values using equality, = or specify neither. 

Hope that = helps. 
http://www.thelastpickle.com

On 15/06/2012, at 5:04 AM, Greg Fausak wrote:

I = have playing around with composite CFs, I have one = declared:

create columnfamily
=    at_event_ac_c
(
   ac_event_id = int,
   ac_creation timestamp,
=    ac_action text,
   ac_addr = text,
   ac_advisory_id text,
=    ac_c text,
...
   ev_sev = text,
...
   ev_total text,
=    ev_url text,
   ev_used text,
=    toast text,
   fw text,
=    name text,
   resp text,
=    size text,
   PRIMARY KEY (ac_c, = ac_creation)
) with compression_parameters:sstable_compression =3D = '';

So, my main primary key is on the ac_c column, text, = and
the secondary composite key is on ac_creation, which is a date. =  These
queries perform correctly:

select * from = at_event_ac_c where ac_c =3D '1234';

select * from at_event_ac_c = where ac_c =3D '1234' and ac_creation >
'2012-07-15' and = ac_creation < '2012-07-18';

What's weird is I can't qualify on = a non-indexed column, like:

select * from at_event_ac_c where = ac_c =3D '1234' and ac_creation >
'2012-07-15' and ac_creation = < '2012-07-18'
  and ev_sev =3D 2;

I get an = error:
Bad Request: No indexed columns present in by-columns clause = with Equal operator

But, I just attended a class on this.  I = thought that once I used my
indices the remaining qualifications = would be satisfied via a filtering
method.  Obviously this is = incorrect.  Is there a way to 'filter' = results?

-g

= --Apple-Mail=_9151EE71-753C-4E4D-9B88-F1E70F93B0D0--