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 20B1C200C16 for ; Thu, 9 Feb 2017 16:49:12 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1F372160B50; Thu, 9 Feb 2017 15:49:12 +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 4396D160B4C for ; Thu, 9 Feb 2017 16:49:11 +0100 (CET) Received: (qmail 93717 invoked by uid 500); 9 Feb 2017 15:49:09 -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 93707 invoked by uid 99); 9 Feb 2017 15:49:09 -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; Thu, 09 Feb 2017 15:49:09 +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 62722182242 for ; Thu, 9 Feb 2017 15:49:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.68 X-Spam-Level: * X-Spam-Status: No, score=1.68 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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, URIBL_BLOCKED=0.001] 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 fO2X027opFYw for ; Thu, 9 Feb 2017 15:49:08 +0000 (UTC) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id E216D5FC6E for ; Thu, 9 Feb 2017 15:49:07 +0000 (UTC) Received: by mail-lf0-f48.google.com with SMTP id x1so4839517lff.0 for ; Thu, 09 Feb 2017 07:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=KQuM7zYQ0J3mRn8Vu0OVC3LioA+EVI5KppU90y77avo=; b=ZMdxk/A3VIjEZIsEILL48rAU53nda1Hn/IKu2hZ05nrjc2gTj9GL1l47LcxnF5SPbx rUwdlhK7bbguvZhhJk367bpZ3SNOrVgV5c2BuqbsYYNjGCLS6VJxSNk1YcXL3p09cpSl 7kUORdCcT7jKs7jc2XGeGQodU6JdTa3e1qSJncfHErecca6seUXjmue3UnVBCrVHy1FI ZE04LVyz92aaN41WIrwf7Kpf6Ow7dZNtBHlOAJSmEhC/wQp3MN4wO4Oh1J/Q1SxTF38A ZHUr7XdXevDQ3Yb7BCAKMIm7gCou9Ms/Xjc8SBbaV/2BmCeR4PSJCU4+PB2TpERJNiuE ps5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=KQuM7zYQ0J3mRn8Vu0OVC3LioA+EVI5KppU90y77avo=; b=XygK4MC0V4lUuWTTZaG0JrnWLz8u2rD7+dOIAfWE6edHSq51/u3wxX5qgfFL56oZxG lRb0CGPWIDxYasso9dlXokPeTef4Mj0xo3jY7+cr3LQJhSr8htyo87ctVQOiPLvn9ntp rMtTwwsS//iYuEQqWhxKG/pjC6UVuhWqMwpftiNEnzryQy8u+PIsTwlTjpNKOA7cZUIb 3Nh0r4DcktuM824A/QwgqtftYAoO/j9Hrx88qT+O+fIvQxkkE2MYaTDiP9qWCmV+7PW8 KNhyrcUroSoJr388qfchglbNCFjgg1RlQxoDBhf3HJAWKEzs8eyUU6dXeu758ed720g7 oQhA== X-Gm-Message-State: AMke39mZM+NxS446uRwo31vqfTDISKLklmrU91pB0+fIEbgKuKlxY0jwL+coa54D+kszSvG+A/bhjJ4x8J8paA== X-Received: by 10.46.87.67 with SMTP id r3mr1406470ljd.31.1486655346475; Thu, 09 Feb 2017 07:49:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.17.65 with HTTP; Thu, 9 Feb 2017 07:49:05 -0800 (PST) In-Reply-To: <9afc6023-9769-dcf0-956d-2a71a86b4a31@redhat.com> References: <9774B01D-0D06-4F2F-96C2-3C8BFA45FA02@cisco.com> <9afc6023-9769-dcf0-956d-2a71a86b4a31@redhat.com> From: Edward Capriolo Date: Thu, 9 Feb 2017 10:49:05 -0500 Message-ID: Subject: Re: Composite partition key token To: "user@cassandra.apache.org" Content-Type: multipart/alternative; boundary=f403045f8934d48aad05481aeb79 archived-at: Thu, 09 Feb 2017 15:49:12 -0000 --f403045f8934d48aad05481aeb79 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Feb 9, 2017 at 9:26 AM, Michael Burman wrote: > Hi, > > How about taking it from the BoundStatement directly? > > ByteBuffer routingKey =3D b.getRoutingKey(ProtocolVersion.NEWEST_SUPPORTE= D, > codecRegistry); > Token token =3D metadata.newToken(routingKey); > > In this case the b is the "BoundStatement". Replace codecRegistry & > ProtocolVersion with what you have. codecRegistry for example from the > codecRegistry =3D session.getCluster().getConfig > uration().getCodecRegistry(); > > - Micke > > > On 02/08/2017 08:58 PM, Branislav Janosik -T (bjanosik - AAP3 INC at > Cisco) wrote: > >> >> Hi, >> >> I would like to ask how to calculate token for composite partition key >> using java api? >> >> For partition key made of one column I use cluster.getMetadata().newToke= n >> (newBuffer); >> >> But what if my key looks like this PRIMARY KEY >> ((parentResourceId,timeRT), childName)? >> >> I read that =E2=80=9C:=E2=80=9D is a separator but it doesn=E2=80=99t se= em to be the case. >> >> How can I create ByteBuffer with multiple values so that the token would >> be actually correct? >> >> Thank you, >> >> Branislav >> >> > This could help: https://github.com/edwardcapriolo/simple-cassandra-tools/blob/master/src/ma= in/java/io/teknek/cassandra/simple/CompositeTool.java --f403045f8934d48aad05481aeb79 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Thu, Feb 9, 2017 at 9:26 AM, Michael Burman <miburman@redhat.com<= /a>> wrote:
Hi,

How about taking it from the BoundStatement directly?

ByteBuffer routingKey =3D b.getRoutingKey(ProtocolVersion.NEWEST_SUPPO= RTED, codecRegistry);
Token token =3D metadata.newToken(routingKey);

In this case the b is the "BoundStatement". Replace codecRegistry= & ProtocolVersion with what you have. codecRegistry for example from t= he codecRegistry =3D session.getCluster().getConfiguration().getCodecR= egistry();

=C2=A0 - Micke


On 02/08/2017 08:58 PM, Branislav Janosik -T (bjanosik - AAP3 INC at Cisco)= wrote:

Hi,

I would like to ask how to calculate token for composite partition key usin= g java api?

For partition key made of one column I use cluster.getMetadata().newToken(newBuffer);

But what if my key looks like this PRIMARY KEY ((parentResourceId,timeRT), = childName)?

I read that =E2=80=9C:=E2=80=9D is a separator but it doesn=E2=80=99t seem = to be the case.

How can I create ByteBuffer with multiple values so that the token would be= actually correct?

Thank you,

Branislav



--f403045f8934d48aad05481aeb79--