Try the enum defined in RowCounter:
private static enum Counters { ROWS }
You will have to make it public or move it elsewhere.
J-D
On Fri, Aug 14, 2009 at 8:08 AM, Rakhi Khatwani<[email protected]> wrote:
> Thanks for the response JD,
> i modified the code according to ur suggesstion.
> and i want to display the number of rows:
> for example
> 09/08/14 15:40:01 INFO mapred.JobClient: RowCounter
> 09/08/14 15:40:01 INFO mapred.JobClient: Rows=171
> so ideally the below code should print 171 right:
> Counters c = JobClient.runJob(rowCounter.createSubmittableJob(new
> String[]{"/user/root/rowCount",TableDefinations.KEYWORD_TABLE,
> TableDefinations.COLUMN_FAMILY_TIMESTAMP})).getCounters();
>
> System.out.println(c.getGroup("RowCounter").getCounter("Rows"));
> but its displays 0. i tried lot of other options as well. but no luck.
> there is also a call
> c.getCounter(Enum key). but coudnt find any Predefined Enums in RowCounter.
>
> Regards,
> Raakhi
>
> On Thu, Aug 13, 2009 at 7:30 PM, Jean-Daniel Cryans
> <[email protected]>wrote:
>
>> Raakhi,
>>
>> If you look at the code, you can see that this line does not return
>> the RunningJob object:
>>
>> JobClient.runJob(createSubmittableJob(args));
>>
>> But since createSubmittableJob is public, you can call it then run the
>> job then use the RunningJob object to get the counters.
>>
>> J-D
>>
>> On Thu, Aug 13, 2009 at 9:54 AM, Rakhi Khatwani<[email protected]>
>> wrote:
>> > Hi,
>> > I wanted to use RowCounter to count the rows of my Hbase Table, so
>> i
>> > wrote a small java class which would display the number of rows in my
>> hbase
>> > table.
>> > Assuming my Hbase table is TestTable with 171 rows and all values in
>> > TestColumnFamily:
>> > here's a code snippet.
>> > main(){
>> > RowCounter rowCounter = new RowCounter();
>> > rowCounter.setConf(jobConf);
>> >
>> > try {
>> > int rowCount = rowCounter.run(new
>> > String[]{"/user/root/rowCount","TestTable", "TestColumnFamily:"});
>> > System.out.println("Number of rows::: " + rowCount);
>> > } catch (Exception e) {
>> > // TODO Auto-generated catch block
>> > e.printStackTrace();
>> > }
>> >
>> > }
>> > my mapreduce program executes successfully...
>> > displays 0 (exit code)
>> > but i dont know how to use the number of rows generated by this mapreduce
>> > for my program. can anyone help me??
>> > Thanks
>> > Raakhi
>> >
>>
>