Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-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 DF7EB10FB4 for ; Thu, 5 Sep 2013 16:15:59 +0000 (UTC) Received: (qmail 99511 invoked by uid 500); 5 Sep 2013 16:15:57 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 99233 invoked by uid 500); 5 Sep 2013 16:15:57 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 99223 invoked by uid 99); 5 Sep 2013 16:15:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Sep 2013 16:15:57 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of anoop.hbase@gmail.com designates 209.85.216.171 as permitted sender) Received: from [209.85.216.171] (HELO mail-qc0-f171.google.com) (209.85.216.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Sep 2013 16:15:53 +0000 Received: by mail-qc0-f171.google.com with SMTP id x19so537426qcw.30 for ; Thu, 05 Sep 2013 09:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=6Jo2iUfiggSBj5jPpyLNMfC/oXcNqeB3AfMRm5zQQE4=; b=tXOKdsidGfUYYyo9/IeL587eHPDZKYUSn6+oA7lRc6aVkw9BJuAyXIPE4AeYb6D22E CMrqum+aZW+Isbn4LKR2nC8Fug+hP4pNIsskC40bGzPVs9CeXPBY9vxxN2NcZCpjnBJL LLyZ2hVY7YruPUvcMo2XQDs3GnwF+i05bBInqtxQ1WOoYe+odOiLv/mbFNAPmcjMC7V0 ZaSoGTln4qK03cjonYtm7mOeLUJ+FGW/iReNJvN3WCseNymT++TjOi0+YWGOkpubTEo/ n65rAhS+xyOVN+5Qt/KTTu8zCwe5rSUcqNXsnMMidDKiJYzA/W40rL+35z7P92jaMwio Dz7A== MIME-Version: 1.0 X-Received: by 10.49.35.177 with SMTP id i17mr9572240qej.77.1378397732269; Thu, 05 Sep 2013 09:15:32 -0700 (PDT) Received: by 10.49.59.201 with HTTP; Thu, 5 Sep 2013 09:15:32 -0700 (PDT) In-Reply-To: References: Date: Thu, 5 Sep 2013 21:45:32 +0530 Message-ID: Subject: Re: Programming practices for implementing composite row keys From: Anoop John To: user@hbase.apache.org Content-Type: multipart/alternative; boundary=047d7b6777f030f6eb04e5a53b47 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b6777f030f6eb04e5a53b47 Content-Type: text/plain; charset=ISO-8859-1 Hi Have a look at Phoenix[1]. There you can define a composite RK model and it handles the -ve number ordering. Also the scan model u mentioned will be well supported with start/stop RK on entity1 and using SkipScanFilter for others. -Anoop- [1] https://github.com/forcedotcom/phoenix On Thu, Sep 5, 2013 at 8:58 PM, Shahab Yunus wrote: > Ah! I didn't know about HBASE-8693. Good information. Thanks Ted. > > Regards, > Shahab > > > On Thu, Sep 5, 2013 at 10:53 AM, Ted Yu wrote: > > > For #2 and #4, see HBASE-8693 'DataType: provide extensible type API' > which > > has been integrated to 0.96 > > > > Cheers > > > > > > On Thu, Sep 5, 2013 at 7:14 AM, Shahab Yunus > > wrote: > > > > > My 2 cents: > > > > > > 1- Yes, that is one way to do it. You can also use fixed length for > every > > > attribute participating in the composite key. HBase scan would be more > > > fitting to this pattern as well, I believe (?) It's a trade-off > basically > > > between space (all that padding increasing the key size) versus > > > complexities involved in deciding and handling a delimiter and > consequent > > > parsing of keys etc. > > > > > > 2- I personally have not heard about this. As far as I understand, this > > > goes against the whole idea of HBase scanning and prefix and fuzzy > > filters > > > will not be possible this way. This should not be followed. > > > > > > 3- See replies to 1 & 2 > > > > > > 4- The sorting of the keys, by default, is binary comparator. It is a > bit > > > tricky as far as I know and the last I checked. Some tips here: > > > > > > > > > http://stackoverflow.com/questions/17248510/hbase-filters-not-working-for-negative-integers > > > > > > Can you normalize them (or take an absolute) before reading and writing > > (of > > > course at the cost of performance) if it is possible i.e. keys with > same > > > amount but different magnitude cannot exist as well as different > > entities. > > > This depends on your business logic and type/nature of data. > > > > > > Regards, > > > Shahab > > > > > > > > > On Thu, Sep 5, 2013 at 10:03 AM, praveenesh kumar < > praveenesh@gmail.com > > > >wrote: > > > > > > > Hello people, > > > > > > > > I have a scenario which requires creating composite row keys for my > > hbase > > > > table. > > > > > > > > Basically it would be . > > > > > > > > Search would be based by entity1 and then entity2 and 3.. I know I > can > > do > > > > row scan on entity1 first and then put row filters on > > entity2 > > > > and entity3. > > > > > > > > My question is what are the best programming principles to implement > > > these > > > > keys. > > > > > > > > 1. Just use simple delimiters . > > > > > > > > 2. Create complex datatypes like java structures. I don't know if > > anyone > > > > uses structures as keys and if they do, can someone please highlight > me > > > for > > > > which scenarios they would be good fit. Does they fit good for this > > > > scenario. > > > > > > > > 3. What are the pros and cons for both 1 and 2, when it comes for > data > > > > retrieval. > > > > > > > > 4. My can be negative also. Does it make any special > > difference > > > > when hbase ordering is concerned. How can I tackle this scenario. > > > > > > > > Any help on how to implement composite row keys would be highly > > helpful. > > > I > > > > want to understand how the community deals with implementing > composite > > > row > > > > keys. > > > > > > > > Regards > > > > Praveenesh > > > > > > > > > > --047d7b6777f030f6eb04e5a53b47--