hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Gray" <jl...@streamy.com>
Subject Re: scanner.next returns null
Date Wed, 01 Jul 2009 15:21:43 GMT
A scanner will return null if there are no rows to be returned.  Are you
certain that your setting this up correctly?

Bytes.toBytes(int) yields the binary representation of the integer (4
byte, big endian).

String.valueOf(int) gives the ASCII representation of the integer (after
.getBytes() you're getting 7 characters yielding 7 bytes).

Both can be correct, but it can only be one or the other.

I recommend the first because this gives you numerical sorted order.  The
second method will give you strange ordering with different length
numbers, so you should use padding to get numerical ordering.

Hope that makes sense.

JG

On Wed, July 1, 2009 12:10 am, Ramesh.Ramasamy wrote:
>

> Hi,
>
>
> I'm trying to use any one of the RowFilterIntergace implementation, for
> example PrefixRowFilter in my code.
>
> ('snpTbl' is the HTable reference)
>
>
> int id = 3136824; PrefixRowFilter prf = new
> PrefixRowFilter(Bytes.toBytes(id+1));
>
>
> Scanner scanner = snpTbl.getScanner(Bytes.toByteArrays("info:"),
> String.valueOf(id).getBytes(), 	prf);
>
>
> RowResult snpRr = scanner.next();
>
>
> I'm always getting the 'snpRr' as null, May some point me out what I am
> doing wrong?
>
> TIA,
> Ramesh
> --
> View this message in context:
> http://www.nabble.com/scanner.next-returns-null-tp24285200p24285200.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
>
>


Mime
View raw message