hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinhong lu <lujinho...@gmail.com>
Subject Re: get first row of every region
Date Wed, 03 Aug 2016 06:53:55 GMT
Thanks a lot. I make a mistake in my code, it should be:
	sc.setStartRow(startRowkey),
not:
       sc.setRowPrefixFilter(startRowkey);
After fix that, it works.


Thanks,
lujinhong

> 在 2016年8月2日,11:12,Phil Yang <ud1937@gmail.com> 写道:
> 
> If you pre-split this table with some split points when you create the
> table, the start key may not be the prefix of the first row key. So you
> should use setStartRow(regionInfo.getStartKey())
> and setStopRow(nextRegionInfo.getStartKey()) and setBatch(1), if the result
> is still null, this region is indeed empty.
> 
> Thanks,
> Phil
> 
> 
> 2016-08-02 10:21 GMT+08:00 jinhong lu <lujinhong2@gmail.com>:
> 
>> Thanks. Here is my code, but in most case, r is null? why this happened?
>> 
>>                                byte[] startRowkey =
>> regionInfo.getStartKey();
>>                                Scan sc = new Scan();
>>                                sc.setBatch(1);
>>                                sc.setRowPrefixFilter(startRowkey);
>>                                try {
>>                                        scanner = table.getScanner(sc);
>>                                        r = scanner.next();
>>                                        scanner.close();
>>                                }
>> Thanks,
>> lujinhong
>> 
>>> 在 2016年8月1日,18:49,Ted Yu <yuzhihong@gmail.com <mailto:
>> yuzhihong@gmail.com>> 写道:
>>> 
>>> .
>> 
>> 


Mime
View raw message