hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haosdent <haosd...@gmail.com>
Subject Re: how to calculate stop key for a scan?
Date Tue, 25 Mar 2014 03:49:17 GMT
MD5(abc) = "900150983cd24fb0d6963f7d28e17f72"
So you could set startkey to "900150983cd24fb0d6963f7d28e17f72" and set
stopkey to "900150983cd24fb0d6963f7d28e17f73".


On Tue, Mar 25, 2014 at 11:45 AM, Li Li <fancyerii@gmail.com> wrote:

> sorry, I want to get all the rows startsWith k1
> example:
> k1    k2           rowKey
> abc aaa  -> MD5(abc)MD5(aaa)
> abc bbb  -> MD5(abc)MD5(bbb)
> abd ddd  -> MD5(abd)MD5(ddd)
>
> how to use scan to get all rows startswith abc
>
> On Tue, Mar 25, 2014 at 11:40 AM, haosdent <haosdent@gmail.com> wrote:
> >>I want to get all the rows equals k1.
> >
> > Use Get(MD5(k1)MD5(k1)) without set startkey and stopkey.
> >
> >
> > On Tue, Mar 25, 2014 at 11:36 AM, Li Li <fancyerii@gmail.com> wrote:
> >
> >> I have two string as primary key(k1,k2)
> >> and my row key in hbase is MD5(k1)MD5(k1)
> >> I want to get all the rows equals k1.I can set startRowKey easily.
> >> But How can I calculate stopRowKey?
> >> is following correct? what if the last byte of md5 is 127? what about
> >> overflow?
> >> any tools for this?
> >>
> >> Scan scan=new Scan();
> >> byte[] start=MD5(key1);
> >> scan.setStartRow(start);
> >> byte[] end=MD5(key1);
> >> end[end.length-1]++
> >> scan.setStopRow(end);
> >>
> >
> >
> >
> > --
> > Best Regards,
> > Haosdent Huang
>



-- 
Best Regards,
Haosdent Huang

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message