Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 69188200B9F for ; Tue, 11 Oct 2016 16:24:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 67755160AE6; Tue, 11 Oct 2016 14:24:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5EB90160AD2 for ; Tue, 11 Oct 2016 16:24:29 +0200 (CEST) Received: (qmail 87552 invoked by uid 500); 11 Oct 2016 14:24:25 -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 87541 invoked by uid 99); 11 Oct 2016 14:24:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2016 14:24:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 749191803EA for ; Tue, 11 Oct 2016 14:24:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.939 X-Spam-Level: * X-Spam-Status: No, score=1.939 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id PDCXyOEVfKYR for ; Tue, 11 Oct 2016 14:24:23 +0000 (UTC) Received: from mail-qk0-f174.google.com (mail-qk0-f174.google.com [209.85.220.174]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 1C9DE5F246 for ; Tue, 11 Oct 2016 14:24:23 +0000 (UTC) Received: by mail-qk0-f174.google.com with SMTP id f128so35132962qkb.1 for ; Tue, 11 Oct 2016 07:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=y/ZAqrAw/5EjMZ9eoVqnp/2QzU6hUsN0NlZBXkFBRRY=; b=TWMx88aLc8kOCsmGXYBhHa0Tgp6On3XR8TEkKzAwL1yAV2CSg7eTKAAWArFMUpN1aN WhAVnS6I0oKAq39wm5eSBwW63D8BIzB1NWuHLY3UHVEqQXyAticZyxyJwW1LlZ2RWoek zG7ZVTOk905eXsUlBF3DEN0/1gNqOZkrtX4wy8ZDqTPUS8c7wZDEZFwoJmOoeaG07TrE t7SKAMQOvhHRjxMm1UXeSoq5MFS5FkKk7+ApbwGQViGDgL/RxjgeSW28AhZmnrVgDRXT f20nl4o5lXjv8sDexY11X88lVZ+D3WRVVJViHgoheOfpyaTbv24pWVFNM4D2zXKtHQLJ ecvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=y/ZAqrAw/5EjMZ9eoVqnp/2QzU6hUsN0NlZBXkFBRRY=; b=Sw2H4euJo6j4+c8sZH4uhAJSHOEGM6hD3h1l1J7C5QtvC1qOnViU6w1GgWXmDeE5bt 0wJVgWqBZcHwsByzUJ/k5DqVaJ2HNR+GDwqTWIAiY2hB++rGfA2+o8H5qUwBKOn36jbY bk8t2Bqo++BpUAjB64C/IK6bM4i4dUoMtp3MnDjCg7wQJUpYwY0FqKOE6zX2we0eZZjq AVzAwL2H0t9lwlbWOkbs0kVyhtYzXZvb1sO+LvLa2K9j36GWWaQOD0DlHRC97nhCFmSi /RhGjb4UbFsBFjLNlkAdXu7WunA2jXfdv3DchdHOZw9bdLPRLF0yXnslAiO91Okudkrs 75hg== X-Gm-Message-State: AA6/9RmgVqSif7b2Obqm2Qbu0B7K5BE92XhmH+FDe447Vub7t7hHunjY+xcuXpoWlDn6nz1Nb5f9hQjLSYwv5Q== X-Received: by 10.194.24.199 with SMTP id w7mr5506085wjf.197.1476195849695; Tue, 11 Oct 2016 07:24:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.41.194 with HTTP; Tue, 11 Oct 2016 07:24:09 -0700 (PDT) In-Reply-To: References: From: Ali Akhtar Date: Tue, 11 Oct 2016 19:24:09 +0500 Message-ID: Subject: Re: Java Driver - Specifying parameters for an IN() query? To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7b5d9adf3d79fc053e97a10a archived-at: Tue, 11 Oct 2016 14:24:30 -0000 --047d7b5d9adf3d79fc053e97a10a Content-Type: text/plain; charset=UTF-8 Justin, I'm asking how to bind a parameter for IN queries thru the java driver. On Tue, Oct 11, 2016 at 7:22 PM, Justin Cameron wrote: > You need to specify the values themselves. > > CREATE TABLE user ( > id int, > type text, > val1 int, > val2 text, > PRIMARY KEY ((id, category), val1, val2) > ); > > SELECT * FROM user WHERE id = 1 AND type IN ('user', 'admin') AND val1 = > 3 AND val2 IN ('a', 'v', 'd'); > > On Tue, 11 Oct 2016 at 07:11 Ali Akhtar wrote: > > Do you send the values themselves, or send them as an array / collection? > Or will both work? > > On Tue, Oct 11, 2016 at 7:10 PM, Justin Cameron > wrote: > > You can pass multiple values to the IN clause, however they can only be > used on the last column in the partition key and/or the last column in the > full primary key. > > Example: > > 'Select * from my_table WHERE pk = 'test' And ck IN (1, 2)' > > > On Tue, 11 Oct 2016 at 06:15 Ali Akhtar wrote: > > If I wanted to create an accessor, and have a method which does a query > like this: > > 'Select * from my_table WHERE pk = ? And ck IN (?)' > > And there were multiple options that could go inside the IN() query, how > can I specify that? Will it e.g, let me pass in an array as the 2nd > variable? > > -- > > Justin Cameron > > Senior Software Engineer | Instaclustr > > > > > This email has been sent on behalf of Instaclustr Pty Ltd (Australia) and > Instaclustr Inc (USA). > > This email and any attachments may contain confidential and legally > privileged information. If you are not the intended recipient, do not copy > or disclose its content, but please reply to this email immediately and > highlight the error to the sender and then immediately delete the message. > > > > > > -- > > Justin Cameron > > Senior Software Engineer | Instaclustr > > > > > This email has been sent on behalf of Instaclustr Pty Ltd (Australia) and > Instaclustr Inc (USA). > > This email and any attachments may contain confidential and legally > privileged information. If you are not the intended recipient, do not copy > or disclose its content, but please reply to this email immediately and > highlight the error to the sender and then immediately delete the message. > > --047d7b5d9adf3d79fc053e97a10a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Justin,

I'm asking how to bind a pa= rameter for IN queries thru the java driver.=C2=A0

On Tue, Oct 11, 2016 at 7:22 P= M, Justin Cameron <justin@instaclustr.com> wrote:
You need to specify the values themselves.
CREATE TABL= E user (
id int,
type text,
val1 int,
val2 text,
PRIMARY KEY ((id, category), val1, val2)
);
=
SELECT * FROM user WHERE id =3D 1 AND=C2=A0type=C2=A0IN ('us= er', 'admin') AND val1 =3D 3 AND val2 IN ('a', 'v&#= 39;, 'd');

On T= ue, 11 Oct 2016 at 07:11 Ali Akhtar <ali.rac200@= gmail.com> wrote:
=
Do you send the values themsel= ves, or send them as an array / collection? Or will both work?

On Tue, Oct 11, 2016 at 7:10 PM, Justin Cameron <justin@in= staclustr.com> wrote:
You can pass multiple values to the IN clause, however t= hey can only be used on the last column in the partition key and/or the las= t column in the full primary key.

Example:

'Select * from my_table WHERE pk =3D 'test&= #39; And ck IN (1, 2)'


On Tue, 11 Oc= t 2016 at 06:15 Ali Akhtar <ali.rac200@gmail.com= > wrote:
If I wanted to crea= te an accessor, and have a method which does a query like this:

'Select * from my_table WHER= E pk =3D ? And ck IN (?)'

And there were multiple options that could go inside the IN() = query, how can I specify that? Will it e.g, let me pass in an array as the = 2nd variable?

--

Justin Cameron

Senior Software = Engineer | Instaclustr




This email has been sent on behalf of Instaclustr Pty Ltd (Austra= lia) and Instaclustr Inc (USA).

This email and any attachment= s may contain confidential and legally privileged information.=C2=A0 If you= are not the intended recipient, do not copy or disclose its content, but p= lease reply to this email immediately and highlight the error to the sender= and then immediately delete the message.





--

Justin Cameron

Senior So= ftware Engineer | Instaclustr




This email h= as been sent on behalf of Instaclustr Pty Ltd (Australia) and Instaclustr I= nc (USA).

This email and any attachments may contain confidential an= d legally privileged information.=C2=A0 If you are not the intended recipie= nt, do not copy or disclose its content, but please reply to this email imm= ediately and highlight the error to the sender and then immediately delete = the message.


--047d7b5d9adf3d79fc053e97a10a--