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 D6D7D73E6 for ; Thu, 3 Nov 2011 20:49:08 +0000 (UTC) Received: (qmail 29655 invoked by uid 500); 3 Nov 2011 20:48:53 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 29634 invoked by uid 500); 3 Nov 2011 20:48:53 -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 29626 invoked by uid 99); 3 Nov 2011 20:48:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Nov 2011 20:48:53 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rajkumar.w93@gmail.com designates 209.85.161.44 as permitted sender) Received: from [209.85.161.44] (HELO mail-fx0-f44.google.com) (209.85.161.44) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Nov 2011 20:48:47 +0000 Received: by faas12 with SMTP id s12so2363302faa.31 for ; Thu, 03 Nov 2011 13:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=3KTGNNzl5dAXokS4FT/jRE6nAaCn7QxKW7KMjU2eYiA=; b=JMePZlSa0LFQyeukN2Yg4turSbcX61pQwhsMdvS9WCah0AbiYHZAgDAx5r5IQxKLS5 pH4f+E8V35Ur1jp0QlrzNsStpE0g3lbMcw9flwoLGhjtHWJJlS7ul0EuwXt9J9Nzwwz5 VXkaAolVBV097pMZzoyHk+nnnFEUDjjS5qv6o= MIME-Version: 1.0 Received: by 10.223.81.196 with SMTP id y4mr18984691fak.6.1320353306368; Thu, 03 Nov 2011 13:48:26 -0700 (PDT) Sender: rajkumar.w93@gmail.com Received: by 10.223.108.83 with HTTP; Thu, 3 Nov 2011 13:48:26 -0700 (PDT) Date: Fri, 4 Nov 2011 02:18:26 +0530 X-Google-Sender-Auth: gF5jHeZ5i5rO53T-Q3Z43qF_5Sc Message-ID: Subject: Concatenating ids with extension to keep multiple rows related to an entity in a single CF From: Aditya Narayan To: user Content-Type: multipart/alternative; boundary=00151750e42acdda6c04b0dab565 --00151750e42acdda6c04b0dab565 Content-Type: text/plain; charset=ISO-8859-1 I am concatenating two Integer ids through bitwise operations(as described below) to create a single primary key of type long. I wanted to know if this is a good practice. This would help me in keeping multiple rows of an entity in a single column family by appending different extensions to the entityId. Are there better ways ? My Ids are of type Integer(4 bytes). public static final long makeCompositeKey(int k1, int k2){ return (long)k1 << 32 | k2; } --00151750e42acdda6c04b0dab565 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I am concatenating =A0two Integer ids through bitwise operations(as describ= ed below) to create a single primary key of type long. I wanted to know if = this is a good=A0practice. This would help me in keeping multiple rows of a= n entity in a single column family by appending different extensions to the= entityId.
Are there better ways ? My Ids are of type Integer(4 bytes).


=A0 =A0 public static final long makeComposite= Key(int k1, int k2){
=A0 =A0 =A0 =A0 return (long)k1 << 32 = | k2;
=A0 =A0 }
--00151750e42acdda6c04b0dab565--