Please see the following in HConstants:
public static final byte [] EMPTY_START_ROW = EMPTY_BYTE_ARRAY;
To get the first key in a region, you can specify the start key obtained
below in a Scan and utilize the following:
* To limit the maximum number of values returned for each call to next(),
* call {@link #setBatch(int) setBatch}.
To get the last key in a region, you can resort to reverse scan.
Cheers
On Tue, Feb 16, 2016 at 8:42 AM, beeshma r <[email protected]> wrote:
> Hi ,
>
> I wanna get Regions first key and last key for Htable.i did code like
> this. please suggest am i doing right way
>
> // people is table name
> //con is Hbase configration
> HTable ht=new HTable(con,"people");
> NavigableMap<HRegionInfo,
> ServerName> np=ht.getRegionLocations();
> Set<HRegionInfo> setinfo=np.keySet();
> List<HRegionInfo> lis=new ArrayList<HRegionInfo>();
> lis.addAll(setinfo);
>
> for(org.apache.hadoop.hbase.HRegionInfo h :lis)
> {
> System.out.println(h.getRegionId() + "getRegionId");
>
> String s = new String(h.getStartKey());
> System.out.println(s.toString()+"-------start key");
> //System.out.println(new String(h.getStartKey())
> +"------end key");
>
> }
> This functionality returns 0 .Means startkey returns as 0(s.length()).But
> am able to get regionid
>
> so anything i misunderstood?
>
> cheers
> Beeshma
> --
>
>
>
>
>
>