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 1F913200C10 for ; Fri, 3 Feb 2017 23:59:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1DF6C160B43; Fri, 3 Feb 2017 22:59:06 +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 0C0BC160B3F for ; Fri, 3 Feb 2017 23:59:03 +0100 (CET) Received: (qmail 97725 invoked by uid 500); 3 Feb 2017 22:59:02 -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 97713 invoked by uid 99); 3 Feb 2017 22:59:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2017 22:59:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id CD83E1A06CB for ; Fri, 3 Feb 2017 22:59:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 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_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id OVPstOT6YD-R for ; Fri, 3 Feb 2017 22:58:58 +0000 (UTC) Received: from mail-yw0-f177.google.com (mail-yw0-f177.google.com [209.85.161.177]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 6BC845FB73 for ; Fri, 3 Feb 2017 22:58:57 +0000 (UTC) Received: by mail-yw0-f177.google.com with SMTP id u68so21214417ywg.0 for ; Fri, 03 Feb 2017 14:58:57 -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=6GrC3P/eKI4+SZPfLJ++p4W21VvQa4qEY7Ucw6SPAfc=; b=GcbmnSqFWROIIrzkhjs1taNFUFPWeNx/e8FDSh2mzV1Wx+R0WebMN4qPGpfyTpHyjJ YJ4IrIIl+k3vQZWtasXpsJkl4Sl+y/1EYFscYPS17TKEuGivMSJVqTalnwrmJg4IDKNu URhzTmAQJuuNcMueBPfKRyZom07QWvFEnRzVpwFm8Ihs8Ldb9yWiwpn3ab7dulqkNx19 OQEGPymtlOhP8LDkn0At5vtEgAaJMCkXCNg24AsQHfMg146IX4CIbN79KDpQOvqHJOcU s6cjp17OlkOQmvEdt0VY0eXeilGJykkIykPQiMUv86fdcNqgZQCMitO0JHU3mPTt4D0h G/Qg== 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=6GrC3P/eKI4+SZPfLJ++p4W21VvQa4qEY7Ucw6SPAfc=; b=LUzXdO/jmA7gBOWf8A0rQU1AYTyLEJa/VYEOZ1eYugk1pmUtq6unyNW/yK1afbohbN iZhewqQFuxi1vneo1CBxjo6mo/19CskGontT/iOa8sWauq5axCgyFQ29V6s8bvvAWCzr YFjrKDY3ztFU88MclfLW5NfPGAX8TLOPicG0l0d91LeaUrShcHnWB23dkznuJfW4lYmx Y0U2w9iQUKds5uSUquqBnZ8L4fIHoVCs2KkZOFiL4sNzTYJ/IjfwMT2ySaWoLkYtDWPk X2qOGHG7nejTkXHuvBkv2gSe2AVLWzs16bxRKnb8m2lL0k4k4KygAhsAsGMJdAoTbmM3 0M6A== X-Gm-Message-State: AIkVDXLlWmoSDn6td20YSuZXWyc+gFKs81XKiFGWWsWfgoUe6uqSez6JbThosJvR/JfNDSfhs0K+dMMRV16pug== X-Received: by 10.129.174.90 with SMTP id g26mr13078097ywk.25.1486162736277; Fri, 03 Feb 2017 14:58:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.170.104 with HTTP; Fri, 3 Feb 2017 14:58:55 -0800 (PST) In-Reply-To: <28620035.35556.1486162001716.JavaMail.root@misoccer.us> References: <28901544.35366.1486160088488.JavaMail.root@misoccer.us> <28620035.35556.1486162001716.JavaMail.root@misoccer.us> From: Ted Yu Date: Fri, 3 Feb 2017 14:58:55 -0800 Message-ID: Subject: Re: help for a fee -- using filters to search data in hbase for correct results To: "user@hbase.apache.org" Content-Type: multipart/related; boundary=f403045f719af98e9e0547a8394f archived-at: Fri, 03 Feb 2017 22:59:06 -0000 --f403045f719af98e9e0547a8394f Content-Type: multipart/alternative; boundary=f403045f719af98e9b0547a8394e --f403045f719af98e9b0547a8394e Content-Type: text/plain; charset=UTF-8 Dropping dev@ again. Your code was looking for column family "name". if (new String(kv.getFamily()).equals("name")) { But from the listing, it was not obvious which rows were in "name" family. You should keep track of the column qualifier(s) (in the nested loop) through the following method of KeyValue : @Deprecated // use CellUtil.getQualifierArray public byte [] getQualifier() { Then you pass the qualifier as second parameter to SingleColumnValueFilter ctor. Cheers On Fri, Feb 3, 2017 at 2:46 PM, Yoom Nguyen wrote: > Hi Ted, > > Release 0.98.8 - 11/18/2014 > > The code get mess up when I sent it through my email client. Here is the > snapshoot of it. > > Thanks, > > > > > ------------------------------ > *From: *"Yoom Nguyen" > *To: *dev@hbase.apache.org > *Sent: *Friday, February 3, 2017 5:14:48 PM > *Subject: *help for a fee -- using filters to search data in hbase for > correct results > > > I am having problems using filters to search data in hbase. > > First I am reading some data from one table and storing in a vector or > arrayList: Is there a better way or different approach to achieve the > results than what I am heading? > > I am stuck trying to get the correct results with the following > approach. Wondering if any one know HBASE \ Java well and willing to > help out for a fee. I need to get over this problem. > > *If anyone is willing to help for a fee, send me an email at > yoom@misoccer.us* > > > for (Result r : rs) { > for (KeyValue kv : r.raw()) { > if (new String(kv.getFamily()).equals("name")) { > temp = new String(kv.getValue()); > x.addElement(temp); > > } > } > } > > Then, I want to search a different table based on the values of this > vector. I used filters to do this: (I tried BinaryPrefixComparator and > BinaryComparator as well) > > FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE); > > > for (int c = 0; c < x.size(); c++) { > System.out.println(x.get(c).toString()); > filterList.addFilter(new SingleColumnValueFilter(Bytes.toBytes("name"), null, CompareOp.EQUAL, new SubstringComparator( x.get(c).toString() ))); > > } > > I should get 3 results back, however I only get one result back, the first > entry in the database. What doesn't make sense is that when I hardcode > the value that I am looking for into my code, I will get all 3 results back. > > I thought there might be some issue with converting the bytes to String > and then back to bytes, but that would not explain how it was able to bring > back the first result. For some reason, it is stopping at the first match > and doesn't continue to find the other 2 rows that contain matching data. > If I hardcode it i get the results: > > x.addElement("abc123");filterList.addFilter(new SingleColumnValueFilter(Bytes.toBytes("name"), null, CompareOp.EQUAL, new SubstringComparator( x.get(0).toString() ))); > > Does anyone know what the problem is or what I need to do to resolve my > issue? Your help is much appreciated. > > Thank You > > edit: Here is the contents of the tables: > > *TABLE1:* ROW COLUMN+CELL > 0 column=gpnum:, timestamp=1481300288449, value=def123 > 0 column=mpnum:, timestamp=1481300273355, value=*abc123* > 0 column=price:, timestamp=1481300255337, value=85.0 > 1 column=gpnum:, timestamp=1481301599999, value=def2244 > 1 column=mpnum:, timestamp=1481301582336, value=*011511607* > 1 column=price:, timestamp=1481301673886, value=0.76 > > *TABLE2* > > ROW COLUMN+CELL > 0 column=brand:, timestamp=1481300227283, value=x > 0 column=mpnum:, timestamp=1481300212289, value=*abc123* > 0 column=price:, timestamp=1481300110950, value=50.0 > 1 column=mpnum:, timestamp=1481301806687, value=*011511607* > 1 column=price:, timestamp=1481301777345, value=1.81 > 13 column=webtype:, timestamp=1483507543878, value=US > 3 column=avail:, timestamp=1481306538360, value=avail > 3 column=brand:, timestamp=1481306538360, value=brand > 3 column=descr:, timestamp=1481306538360, value=description > 3 column=dist:, timestamp=1481306538360, value=distributor > 3 column=mpnum:, timestamp=1481306538360, value=pnum > 3 column=price:, timestamp=1481306538360, value=price > 3 column=url:, timestamp=1481306538360, value=url > 3 column=webtype:, timestamp=1481306538360, value=webtype > 4 column=avail:, timestamp=1481306538374, value=4 > 4 column=brand:, timestamp=1481306538374, value=x > 4 column=descr:, timestamp=1481306538374, value=description > 4 column=dist:, timestamp=1481306538374, value=x > 4 column=mpnum:, timestamp=1482117383212, value=*011511607* > 4 column=price:, timestamp=1481306538374, value=34.51 > 4 column=url:, timestamp=1481306538374, value=x > 4 column=webtype:, timestamp=1481306538374, value=US > 5 column=avail:, timestamp=1481306538378, value= > 5 column=brand:, timestamp=1481306538378, value=name > 5 column=descr:, timestamp=1481306538378, value=x > 5 column=dist:, timestamp=1481306538378, value=x > 5 column=mpnum:, timestamp=1482117392043, value=*011511607* > 5 column=price:, timestamp=1481306538378, value=321.412 > 5 column=url:, timestamp=1481306538378, value=x.com > > *THIRD TABLE (to store result matches)* > > 0 column=brand:, timestamp=1481301813849, value=name > 0 column=cprice:, timestamp=1481301813849, value=1.81 > 0 column=gpnum:, timestamp=1481301813849, value=def2244 > 0 column=gprice:, timestamp=1481301813849, value=0.76 > 0 column=mpnum:, timestamp=1481301813849, value=011511607 > > **should be three matches those that are in bold above but only brings > back one match > > *If anyone is willing to help for a fee, send me an email at > yoom@misoccer.us* > > > *Thanks,* > > > *Yoom* > > > --f403045f719af98e9b0547a8394e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Dropping dev@ again.
Your code was looking for column = family "name".
           if (new String(kv.<=
/span>getFamily()).equals("name")) {
But from= the listing, it was not obvious which rows were in "name" family= .
You should= keep track of the column qualifier(s) (in the nested loop) through the fol= lowing method of=C2=A0KeyValue :

=C2=A0 @Deprecated // use CellUtil.getQualifierArray
=C2=A0 public byte [] getQualifier() {

Then you pass the qua= lifier as second parameter to=C2=A0SingleColumnValueFilter ctor.

Ch= eers

On Fri, Feb= 3, 2017 at 2:46 PM, Yoom Nguyen <yoom@misoccer.us> wrote:
Hi Ted,

Release 0.98.8 - 11/18/2014
The code get mess up when I sent it through my email client.=C2=A0 Here is= the snapshoot of it.

Thanks,

3D""



From: "Yoom Nguyen" <yoom@misoccer.us>
To: dev@hbase.apach= e.org
Sent: Friday, February 3, 2017 5:14:48 PM
Subject= : help for a fee =C2=A0-- using filters =C2=A0to search data in hbase f= or correct results


I am having problems usi= ng filters to search data in hbase.

First I am reading some data from one tab= le and storing in a vector or arrayList<= /span>:=C2=A0=C2=A0 Is there a better way or different approach to achieve = the results than what I am heading?

I am stu= ck trying to get the correct results with the following approach.=C2=A0=C2= =A0 Wondering if any one know HBASE \ Java well and willing to help out for a fee.=C2=A0 I need to get over = this problem.=C2=A0

If anyone is wi= lling to help for a fee, send me an email at yoom@misoccer.us


    for (Result r : rs)=
 {
        for (KeyValue kv : r.raw()) {
            if (new Str=
ing(kv.=
getFamily()).equals("name"<=
/span>)) {
                temp =3D new String(kv.getValue());
                x=
.addElement(temp);<=
span class=3D"gmail-m_2025922679094325464pln" style=3D"margin:0px;padding:0=
px;border:0px;font-size:13px;color:rgb(48,51,54)">

            }
        }<=
span class=3D"gmail-m_2025922679094325464pln" style=3D"margin:0px;padding:0=
px;border:0px;font-size:13px;color:rgb(48,51,54)">
    }

Then, I w= ant to search a different table based on the values of this vector. I used = filters to do this: (I tried=C2=A0BinaryPrefixComparator=C2=A0and=C2=A0BinaryComparator<= /code>=C2= =A0as well)

  FilterList filterList=
 =3D new FilterList(FilterList=
.Operator.MUST_PASS_ONE);   =20


    for (int c =3D=
 0; c < x.size(); c++) {
       System.out.println(x.get(c).toString()); =
        =20
       filterList.addFilter(new SingleColumnValueFilter=
(Bytes.toBytes("name"), null, CompareOp.EQUAL, new SubstringComparator( x.get(c).toString=
()  )));

    }

I should get 3 r= esults back, however I only get one result back, the first entry in the dat= abase. What doesn't make sense is that when I hardcode the value that I am looking for into my code, I w= ill get all 3 results back.

I thought there = might be some issue with converting the bytes to String and then back to by= tes, but that would not explain how it was able to bring back the first res= ult. For some reason, it is stopping at the first match and doesn't con= tinue to find the other 2 rows that contain matching data. If I hardcode it i get the results:

x.addElement("abc123"); filterList.addFilter
(new SingleColumnValueFilter= (Bytes.toBytes("name"), null, C= ompareOp.= EQUAL, new SubstringComparator( x= .get(0).t= oString()<= span class=3D"gmail-m_2025922679094325464pln" style=3D"margin:0px;padding:0= px;border:0px;font-size:13px;color:rgb(48,51,54)"> )));

Does anyone know what the problem is or = what I need to do to resolve my issue? Your help is much appreciated.

Thank You

edit: He= re is the contents of the tables:

TABLE1:=C2=A0ROW COLUMN+CELL
0 column= =3Dgpnum:, timestamp=3D1481300288449, value=3Ddef123
0 column= =3Dmpnum:, timestamp=3D1481300273355, value=3Dabc123
0 column=3Dprice:, timestamp
=3D1481300255337, value=3D85.0
1 column=3Dgpnum:, timestamp= =3D1481301599999, value=3Ddef2244
1 column=3Dmpnum:, timestamp= =3D1481301582336, value=3D011511607
1 column=3D= price:, timestamp=3D1481301673886= , value=3D0.76

TABLE2

<= p style=3D"margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:b= oth;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvet= ica,sans-serif;font-style:normal;font-variant-ligatures:normal;font-variant= -caps:normal;font-weight:normal;letter-spacing:normal;text-align:left;text-= indent:0px;text-transform:none;white-space:normal;word-spacing:0px;backgrou= nd-color:rgb(255,255,255)">

ROW COLUMN+CELL=
0 column=3Dbrand:, timestamp= =3D1481300227283, value=3Dx
0 column=3Dmpnum:, timestamp=3D1481= 300212289, value=3Dabc123
0 column=3Dprice:, timestamp=3D1481300110950, value=3D50.01 column=3Dmpnum:, timestamp=3D1481301806687, value=3D0= 11511607
1 column=3Dprice:, = timestamp=3D1481301777345, value=3D1.81
13 column=3Dwebtype:, t= imestamp=3D1483507543878, value=3DUS
3 column=3Davail:, timestamp=3D1481306538360, value=3Davail<= br>3 column=3Dbrand:, timestamp= =3D1481306538360, value=3Dbrand
3 column=3Ddescr:, timestamp= =3D1481306538360, value=3Ddescription
3 column=3Ddist:, timestamp=3D1481306538360, value=3Ddistributor3 column=3Dmpnum:, timestamp=3D1481306538360, value=3Dpnum
3 column=3Dprice:, timestamp=3D1481306538360, value=3Dprice
3 colu= mn=3Durl:, timestamp=3D1481306538360, value=3Durl
3 column=3D= webtype:, timestamp=3D1481= 306538360, value=3Dwebtype
4 c= olumn=3Davail:, timestamp=3D14813= 06538374, value=3D4
4 column=3Dbrand:, timestamp=3D1481306538374, value=3Dx
4 column=3Ddescr:, times= tamp=3D1481306538374, value=3Ddescription
4 column=3Ddist:, timestamp=3D1481306538374, value=3Dx4 column=3Dmpnum:, timestamp=3D1482117383212, value=3D0= 11511607
4 column=3Dprice:, = timestamp=3D1481306538374, value=3D34.51
4 column=3Durl:, times= tamp=3D1481306538374, value=3Dx
4 column=3Dwebtype:, timestamp<= /span>=3D1481306538374, value=3DUS
5 column=3Davail:, timestamp=3D1481306538378, value=3D
5 column=3Db= rand:, timestamp=3D1481306538378,= value=3Dname
5 column=3Ddescr= :, timestamp=3D1481306538378, val= ue=3Dx
5 column=3Ddist:, timestamp=3D1481306538378, value=3Dx
5 column=3Dmpnum:, timestamp= =3D1482117392043, value=3D011511607
5 column=3Dprice:,= timestamp=3D1481306538378, value= =3D321.412
5 column=3Durl= :, timestamp=3D14813065383= 78, value=3Dx.com

THIRD TABLE (to sto= re result matches)

0 column=3Dbrand:, timesta= mp=3D1481301813849, value=3Dname
0 column=3Dcprice:, timestamp<= /span>=3D1481301813849, value=3D1.81
0 column=3Dgpnum:, timestamp=3D1481301813849, value=3Ddef2244
0 column=3Dgprice:, timestamp=3D1481301813849, value=3D0.76
0 column=3Dmpnum:, timestamp=3D1481301813849, value=3D011511607

**should be three matches those that are in bold above = but only brings back one match

If a= nyone is willing to help for a fee, send me an email at yoom@misoccer.us


Thanks,

Yoom




<= /div> --f403045f719af98e9b0547a8394e-- --f403045f719af98e9e0547a8394f--