You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Oleg Mürk <ol...@gmail.com> on 2012/02/08 14:10:13 UTC

Counting rows from Thrift API

Hello,

I would like to ask if it is possible to count rows matching a given
prefix in a HBase table using Python Thrift API?
Currently I have to fetch all these rows and then count them.

Thank You!
Oleg Mürk

Re: Counting rows from Thrift API

Posted by Oleg Mürk <ol...@gmail.com>.
Hi,

On Wed, Feb 8, 2012 at 8:22 PM, Ted Yu <yu...@gmail.com> wrote:
> Looking at src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java:
>    public int scannerOpenWithPrefix(ByteBuffer tableName,
>                                     ByteBuffer startAndPrefix,
>                                     List<ByteBuffer> columns)
>
> Would the above API satisfy Oleg's requirement ?

My initial question was about how to count the number of rows
*without* fetching them to the client-side.

Best,
Oleg

Re: Counting rows from Thrift API

Posted by Ted Yu <yu...@gmail.com>.
Looking at src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java:
    public int scannerOpenWithPrefix(ByteBuffer tableName,
                                     ByteBuffer startAndPrefix,
                                     List<ByteBuffer> columns)

Would the above API satisfy Oleg's requirement ?

On Wed, Feb 8, 2012 at 5:25 AM, Wojciech Langiewicz
<wl...@gmail.com>wrote:

> Hi,
> AFAIK this is not possible, unless you are using HBase 0.92 with
> coprocessors ( https://blogs.apache.org/**hbase/entry/coprocessor_**
> introduction<https://blogs.apache.org/hbase/entry/coprocessor_introduction>), but even then I really doubt this feature will be included in Thrift API
> - my experience shows, that Thrift APIa are not up-to-date with features
> that HBase has.
>
>
>
> On 08.02.2012 14:10, Oleg Mürk wrote:
>
>> Hello,
>>
>> I would like to ask if it is possible to count rows matching a given
>> prefix in a HBase table using Python Thrift API?
>> Currently I have to fetch all these rows and then count them.
>>
>> Thank You!
>> Oleg Mürk
>>
>
> --
> Wojciech Langiewicz
>

Re: Counting rows from Thrift API

Posted by Oleg Mürk <ol...@gmail.com>.
Hello,

On Wed, Feb 8, 2012 at 3:25 PM, Wojciech Langiewicz
<wl...@gmail.com> wrote:
> Hi,
> AFAIK this is not possible, unless you are using HBase 0.92 with
> coprocessors ( https://blogs.apache.org/hbase/entry/coprocessor_introduction
> ), but even then I really doubt this feature will be included in Thrift API
> - my experience shows, that Thrift APIa are not up-to-date with features
> that HBase has.

Thanks for the answer. I made it work substantially faster by setting
in hbase-site.conf of the *thrift server*:
  hbase.client.scanner.caching=1000
Otherwise it seems that the thrift server was doing N roundtrips for each
  client.scannerGetList(scanner_id, N)

Thanks!
Oleg

Re: Counting rows from Thrift API

Posted by Wojciech Langiewicz <wl...@gmail.com>.
Hi,
AFAIK this is not possible, unless you are using HBase 0.92 with 
coprocessors ( 
https://blogs.apache.org/hbase/entry/coprocessor_introduction ), but 
even then I really doubt this feature will be included in Thrift API - 
my experience shows, that Thrift APIa are not up-to-date with features 
that HBase has.


On 08.02.2012 14:10, Oleg Mürk wrote:
> Hello,
>
> I would like to ask if it is possible to count rows matching a given
> prefix in a HBase table using Python Thrift API?
> Currently I have to fetch all these rows and then count them.
>
> Thank You!
> Oleg Mürk

--
Wojciech Langiewicz