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 219E510726 for ; Thu, 12 Dec 2013 21:21:33 +0000 (UTC) Received: (qmail 29384 invoked by uid 500); 12 Dec 2013 21:21:30 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 29331 invoked by uid 500); 12 Dec 2013 21:21:30 -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 29323 invoked by uid 99); 12 Dec 2013 21:21:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Dec 2013 21:21:30 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [72.30.238.138] (HELO nm36-vm2.bullet.mail.bf1.yahoo.com) (72.30.238.138) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 12 Dec 2013 21:21:23 +0000 Received: from [66.196.81.173] by nm36.bullet.mail.bf1.yahoo.com with NNFMP; 12 Dec 2013 21:21:02 -0000 Received: from [98.139.212.200] by tm19.bullet.mail.bf1.yahoo.com with NNFMP; 12 Dec 2013 21:21:02 -0000 Received: from [127.0.0.1] by omp1009.mail.bf1.yahoo.com with NNFMP; 12 Dec 2013 21:21:02 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 108575.21535.bm@omp1009.mail.bf1.yahoo.com Received: (qmail 77538 invoked by uid 60001); 12 Dec 2013 21:21:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1386883262; bh=F2rrtkgz881uMN86vSDJTul7ED4jtAWEXozqwDcyPKE=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-RocketYMMF:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=F3TyIF7NpPZdisX/fTPZW4nzAW9oFelIKAh58nJFG9Fs0JqJ0EJ/xsV/Yz9/Pi4JTkivurjan25hVGQfuyKUGqyQOIgJU2towFTp2hMe428cT+vC5B6muNWDyATPJfOv2Cga16apxWYSV6nWCjhT863UMdsAvHvxbeE64Cq2Qnk= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-RocketYMMF:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=MkSo+TzkWA3Sbe8P9nMl4QLMZGpscoW5m7IsWRtgSHa032eKd9XNdz7rwd9mB95OLFjfBnvtrdyWHNC4gWT5nSOve7XS6mjWgwI/MqTHM6CSuvsydeXujg2ouAGU8mY5tF82RMHKcN1VaAx1xR8atizIfO2G9WOwR9PqKv/0S9M=; X-YMail-OSG: 3l6j8C8VM1nOR74oefj_.HSfqiya3EKumNjDdXI4gZPhMnv pMu.EXRVXhjORDbtZQJ8HKa9450YC6Sv37XQDRC9uQWkV3TXc4YwMV_dR7O6 1UfXIUtwksufigULmNcJxiZCJjXbZts8PSLGuKskSAq2llTGulW4jrsFN1oW NaFe1k3hanLKgo33eZvw.0wBTgmCTSxjAuot3Bw_IQN.LQFWvBo0C8YJUiJ4 7JcRFBhCfgmZDDmrBy85kwTryZtr3dY3GJ.I_fO5ZUA3S9RYdx5lvyBFrIw9 OLRuUQz8slapRy9Mb3NV.8Wx8o3loOfTHhKmG5DcA4kgYoXF0pIhMmpQnUNO rEQfwnV11TMES0a_4rWVWM0gJsLgojORCMrcSnesMQaQQTPPuq4EzAGLBpv. vmLZ2KX2PllJM52RJLr6S.IvFnJkTDusqt8Xb6AjTwQa0qUjFvx9PewY2JC5 gnDMXf1_fGJns7IgEwXi49wQJVofzLVOXDcUrfEbxZE9VZY3EtVQAP5WXVxR fhBSuU6mLFDW91.5a5NlE0IrfH7V1FvJpXbc20Hd4iKFp2SekZ4WJWkk23se W.Nhhqp8HYh5ECIY- Received: from [204.14.239.221] by web140602.mail.bf1.yahoo.com via HTTP; Thu, 12 Dec 2013 13:21:01 PST X-Rocket-MIMEInfo: 002.001,SGkgU2FpcGgsCgpubyBuZWVkIHRvIGFwb2xvZ2l6ZS4KUGxlYXNlIGtlZXAgYXNraW5nIHF1ZXN0aW9ucyBhcyB5b3UgZW5jb3VudGVyIGlzc3Vlcy4gOikKCi0tIExhcnMKCgoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KIEZyb206IFNhaXBoIEthcHBhIDxzYWlwaC5rYXBwYUBnbWFpbC5jb20.ClRvOiB1c2VyQGhiYXNlLmFwYWNoZS5vcmcgClNlbnQ6IFRodXJzZGF5LCBEZWNlbWJlciAxMiwgMjAxMyAxMjo1OSBQTQpTdWJqZWN0OiBSZTogSEJhc2UgQ2xpZW50OiBIb3cgY2FuIEkgbWVyZ2UBMAEBAQE- X-RocketYMMF: lhofhansl X-Mailer: YahooMailWebService/0.8.169.609 References: Message-ID: <1386883261.70827.YahooMailNeo@web140602.mail.bf1.yahoo.com> Date: Thu, 12 Dec 2013 13:21:01 -0800 (PST) From: lars hofhansl Reply-To: lars hofhansl Subject: Re: HBase Client: How can I merge 2 results into 1? To: "user@hbase.apache.org" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-118416272-1017229293-1386883261=:70827" X-Virus-Checked: Checked by ClamAV on apache.org ---118416272-1017229293-1386883261=:70827 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi Saiph,=0A=0Ano need to apologize.=0APlease keep asking questions as you = encounter issues. :)=0A=0A-- Lars=0A=0A=0A=0A______________________________= __=0A From: Saiph Kappa =0ATo: user@hbase.apache.org= =0ASent: Thursday, December 12, 2013 12:59 PM=0ASubject: Re: HBase Client:= How can I merge 2 results into 1?=0A =0A=0AI apologize, but I did a mistak= e. I was merging keyvalues from different=0Arows (there was a problem in th= e way I was comparing and decoding the=0Abyte[] of rows) into a single resu= lt, which is not possible naturally.=0A=0ATherefore, I ask you to delete th= is thread.=0A=0AThanks and sorry for any inconvenience.=0A=0A=0A=0AOn Thu, = Dec 12, 2013 at 6:27 PM, Saiph Kappa wrote:=0A=0A> = Hi,=0A>=0A> I am using version 0.94.14 and I am trying to merge KeyValues o= f 2 results=0A> into 1 result.=0A>=0A> Basically somewhere in time I cache = a keyvalue of a result:=0A>=0A> ### Putting in cache KeyValue with key:=0A>= \x00\x09\x00\x00\x00\x04\x00\x00\x00\x00\x07\x011c\x00\x00\x01B\xE2\xE0\x0= C\xEF\x04,=0A> tableName: STOCK, Family: 1, Qualifier: c, Value: ^@^@^@3=0A= >=0A> Later I get that KeyValue from my cache and add it to a list=0A> (Lis= t kvs). Then I add some more KeyValues from a Result=0A> instanc= e to that list:=0A>=0A>=A0 =A0 =A0 =A0 =A0 =A0 kvs.addAll(partialResult.li= st());=0A>=A0 =A0 =A0 =A0 =A0 =A0 Collections.sort(kvs, KeyValue.COMPARATO= R);=0A>=0A> Finally, I build a new result with all those KeyValues ( new Re= sult(kvs) ).=0A>=0A> When I iterate through the map of that result I can re= ad all values=0A> correctly:=0A>=0A>=A0 =A0 =A0 =A0 =A0 =A0 for (byte[] f = : result.getMap().keySet()) {=0A>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.ou= t.print("### Result2 Family: " +=0A> Bytes.toString(f));=0A>=A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 for (byte[] q : result.getFamilyMap(f).keySet()) {=0A>=A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.out.print(" : Qualifier: " + B= ytes.toString(q)=0A> + " :: Value: "=0A>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 +=0A> Bytes.toString(result.getFamilyMap(f).get(q)));= =0A>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }=0A>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = System.out.println();=0A>=A0 =A0 =A0 =A0 =A0 =A0 }=0A>=0A> But if I try to= get values using result.getValue(...):=0A>=0A>=A0 for (byte[] f : result.g= etMap().keySet()) {=0A>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.out.print("#= ## Result Family: " +=0A> Bytes.toString(f));=0A>=A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 for (byte[] q : result.getMap().get(f).keySet()) {=0A>=A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.out.print(" : Qualifier: " + Bytes.toSt= ring(q)=0A> + " :: Value: " + Bytes.toString(result.getValue(f, q)));=0A>= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }=0A>=A0 }=0A>=0A> I only get the 2 first= values, others are returned as null.=0A>=0A> Here is the kvs list (where t= he first KeyValue was merged with the other 5=0A> KeyValues):=0A>=0A> ### K= VS Key:=0A> \x00\x09\x00\x00\x00\x04\x00\x00\x00\x00\x07\x011c\x00\x00\x01B= \xE2\xE0\x0C\xEF\x04,=0A> Family: 1, Qualifier: c, Value: ^@^@^@3=0A> ### K= VS Key:=0A> \x00\x09\x00\x00\x00\x04\x00\x00\x01a\x97\x011j\x00\x00\x01B\xE= 2\xE0\xF0\x9D\x04,=0A> Family: 1, Qualifier: j, Value: niutpzbmnewnfsowrlau= xeda=0A> ### KVS Key:=0A> \x00\x09\x00\x00\x00\x04\x00\x00\x01a\x97\x011n\x= 00\x00\x01B\xE2\xE0\xF0\x9D\x04,=0A> Family: 1, Qualifier: n, Value: ^@^@^@= ^@=0A> ### KVS Key:=0A> \x00\x09\x00\x00\x00\x04\x00\x00\x01a\x97\x011o\x00= \x00\x01B\xE2\xE0\xF0\x9D\x04,=0A> Family: 1, Qualifier: o, Value: ^@^@^@^@= =0A> ### KVS Key:=0A> \x00\x09\x00\x00\x00\x04\x00\x00\x01a\x97\x011p\x00\x= 00\x01B\xE2\xE0\xF0\x9D\x04,=0A> Family: 1, Qualifier: p, Value: ^@^@^@^@= =0A> ### KVS Key:=0A> \x00\x09\x00\x00\x00\x04\x00\x00\x01a\x97\x011q\x00\x= 00\x01B\xE2\xE0\xF0\x9D\x04,=0A> Family: 1, Qualifier: q, Value:=0A> nbdpcw= gwriaysaiqgkfozcacvalqymmuybsaoodidnbbltioqh=0A> kvs length: 6=0A>=0A>=0A> = I tried to look further inside the code of Result.getValue and I noticed=0A= > that this line:=0A> int pos =3D Arrays.binarySearch(kvs, searchTerm, KeyV= alue.COMPARATOR);=0A> is returning -2 to the last 4 KeyValues in the kvs li= st, and that's why I=0A> was getting those values as null.=0A>=0A> (If I do= not merge the first KeyValue the pos is returned correctly)=0A>=0A> Why do= es this happen? What am I doing wrong?=0A>=0A> Thanks.=0A> ---118416272-1017229293-1386883261=:70827--