You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Arun Patel <ar...@gmail.com> on 2015/12/04 22:10:55 UTC
Count rows in HBase based on partial rowkeys
I am storing multiple applications (APP1 and APP2) data in same table as
shown below.
Sample rowkeys are APP1 and APP2 are
fd26420829cf4286949f77521019473d0e7e0f06-APP1-docid1
7446eabb0cf2bc9f5f7c4fa0d9d3dfcdef4bb198-APP1-docid2
45c6ed2b4879338a4b40c3f0f82fb0765b5eeb1c-APP2-mydoc1
87a141aea9a09eeaa66aed4b6e6bde7cc44f365a-APP2-mydoc2
Is there a way to COUNT how many rows are for APP1 and APP2? Command line,
JRuby or Java?
Regards,
Arun
Re: Count rows in HBase based on partial rowkeys
Posted by Arun Patel <ar...@gmail.com>.
Thanks Ted.
Any easy way to this through command line? or may be through JRuby?
On Fri, Dec 4, 2015 at 4:16 PM, Ted Yu <yu...@gmail.com> wrote:
> Looks like the row key prefix has fixed length (40 characters).
>
> Please take a look at FuzzyRowFilter
>
> Example can be found in:
>
> hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java
>
> Cheers
>
>
>
> On Fri, Dec 4, 2015 at 1:10 PM, Arun Patel <ar...@gmail.com>
> wrote:
>
> > I am storing multiple applications (APP1 and APP2) data in same table as
> > shown below.
> >
> > Sample rowkeys are APP1 and APP2 are
> >
> > fd26420829cf4286949f77521019473d0e7e0f06-APP1-docid1
> > 7446eabb0cf2bc9f5f7c4fa0d9d3dfcdef4bb198-APP1-docid2
> >
> > 45c6ed2b4879338a4b40c3f0f82fb0765b5eeb1c-APP2-mydoc1
> > 87a141aea9a09eeaa66aed4b6e6bde7cc44f365a-APP2-mydoc2
> >
> > Is there a way to COUNT how many rows are for APP1 and APP2? Command
> line,
> > JRuby or Java?
> >
> > Regards,
> > Arun
> >
>
Re: Count rows in HBase based on partial rowkeys
Posted by Ted Yu <yu...@gmail.com>.
Looks like the row key prefix has fixed length (40 characters).
Please take a look at FuzzyRowFilter
Example can be found in:
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java
Cheers
On Fri, Dec 4, 2015 at 1:10 PM, Arun Patel <ar...@gmail.com> wrote:
> I am storing multiple applications (APP1 and APP2) data in same table as
> shown below.
>
> Sample rowkeys are APP1 and APP2 are
>
> fd26420829cf4286949f77521019473d0e7e0f06-APP1-docid1
> 7446eabb0cf2bc9f5f7c4fa0d9d3dfcdef4bb198-APP1-docid2
>
> 45c6ed2b4879338a4b40c3f0f82fb0765b5eeb1c-APP2-mydoc1
> 87a141aea9a09eeaa66aed4b6e6bde7cc44f365a-APP2-mydoc2
>
> Is there a way to COUNT how many rows are for APP1 and APP2? Command line,
> JRuby or Java?
>
> Regards,
> Arun
>