You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by beeshma r <be...@gmail.com> on 2016/02/15 18:23:44 UTC

Getting Htable first key and last key

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
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");

            }

--