You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Dalia Sobhy <da...@hotmail.com> on 2012/11/10 23:11:23 UTC

Question

Dear all,

I want to use the aggregate functions, but do anyone have a code or sth to understand them ..

Thanks

Best Regards
Dalia
 		 	   		  

Re: Question

Posted by yu...@gmail.com.
What error did you get ?
Please use pastebin to share. 

Thanks



On Nov 11, 2012, at 11:42 AM, Dalia Sobhy <da...@hotmail.com> wrote:

> 
> Hi Ted,
> 
> I am using hbase 0.92.1
> 
> When I tried the following code I got errors:
> 
> AggregateProtocol agg;   
>  long rowcount = agg.getRowNum(ColumnInterpreter<string, int>, scan);
> 
>  double sum = aggregationClient.avg(TABLE_NAME, ci, scan);
> 
> even though I tried it with String (s in capital) same errors, do u know why?
> 
>> Date: Sun, 11 Nov 2012 08:24:29 -0800
>> Subject: Re: Question
>> From: yuzhihong@gmail.com
>> To: user@hbase.apache.org
>> 
>> Dalia:
>> If you look at:
>> public interface ColumnInterpreter<T, S> {
>> 
>> you would see:
>> * @param <T> Cell value data type
>> * @param <S> Promoted data type
>> 
>> S can represent sum of values of T. The rationale was that aggregation of
>> one type (integer, e.g.) may have to be represented by another type
>> (double, e.g.)
>> 
>> From this blog you can get some history on this subject:
>> http://zhihongyu.blogspot.com/2011/03/genericizing-endpointcoprocessor.html
>> 
>> For row counting, it is already implemented:
>>  public <T, S> long getRowNum(ColumnInterpreter<T, S> ci, Scan scan)
>> You can embed your filter in scan object.
>> 
>> Cheers
>> 
>> On Sun, Nov 11, 2012 at 8:07 AM, Dalia Sobhy <da...@hotmail.com>wrote:
>> 
>>> 
>>> 
>>> Thanks Ted :D
>>> 
>>> But can anyone explain to me this sentence:
>>> 
>>> ColumnInterpreter<T, S> ci
>>> 
>>> How to set a ColumnInterpreter ?? What is T and Whats S?
>>> 
>>> I want to perform average on an Aggregationclient, so could anyone provide
>>> me with a sample code?
>>> 
>>> Also if i want to count the number of rows which has a specific value ?
>>> What to use Filters or AggregationClient?
>>> 
>>> Thanks in advance,
>>> 
>>>> Date: Sat, 10 Nov 2012 14:25:22 -0800
>>>> Subject: Re: Question
>>>> From: yuzhihong@gmail.com
>>>> To: user@hbase.apache.org
>>>> 
>>>> Take a look at AggregationClient.java and TestAggregateProtocol.java
>>>> 
>>>> Cheers
>>>> 
>>>> On Sat, Nov 10, 2012 at 2:11 PM, Dalia Sobhy <dalia.mohsobhy@hotmail.com
>>>> wrote:
>>>> 
>>>>> 
>>>>> Dear all,
>>>>> 
>>>>> I want to use the aggregate functions, but do anyone have a code or
>>> sth to
>>>>> understand them ..
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> Best Regards
>>>>> Dalia
>>>>> 
>>> 
>>> 
>                         

RE: Question

Posted by Dalia Sobhy <da...@hotmail.com>.
Hi Ted,

I am using hbase 0.92.1

When I tried the following code I got errors:

 AggregateProtocol agg;   
  long rowcount = agg.getRowNum(ColumnInterpreter<string, int>, scan);
    
  double sum = aggregationClient.avg(TABLE_NAME, ci, scan);

even though I tried it with String (s in capital) same errors, do u know why?

> Date: Sun, 11 Nov 2012 08:24:29 -0800
> Subject: Re: Question
> From: yuzhihong@gmail.com
> To: user@hbase.apache.org
> 
> Dalia:
> If you look at:
> public interface ColumnInterpreter<T, S> {
> 
> you would see:
>  * @param <T> Cell value data type
>  * @param <S> Promoted data type
> 
> S can represent sum of values of T. The rationale was that aggregation of
> one type (integer, e.g.) may have to be represented by another type
> (double, e.g.)
> 
> From this blog you can get some history on this subject:
> http://zhihongyu.blogspot.com/2011/03/genericizing-endpointcoprocessor.html
> 
> For row counting, it is already implemented:
>   public <T, S> long getRowNum(ColumnInterpreter<T, S> ci, Scan scan)
> You can embed your filter in scan object.
> 
> Cheers
> 
> On Sun, Nov 11, 2012 at 8:07 AM, Dalia Sobhy <da...@hotmail.com>wrote:
> 
> >
> >
> > Thanks Ted :D
> >
> > But can anyone explain to me this sentence:
> >
> > ColumnInterpreter<T, S> ci
> >
> > How to set a ColumnInterpreter ?? What is T and Whats S?
> >
> > I want to perform average on an Aggregationclient, so could anyone provide
> > me with a sample code?
> >
> > Also if i want to count the number of rows which has a specific value ?
> > What to use Filters or AggregationClient?
> >
> > Thanks in advance,
> >
> > > Date: Sat, 10 Nov 2012 14:25:22 -0800
> > > Subject: Re: Question
> > > From: yuzhihong@gmail.com
> > > To: user@hbase.apache.org
> > >
> > > Take a look at AggregationClient.java and TestAggregateProtocol.java
> > >
> > > Cheers
> > >
> > > On Sat, Nov 10, 2012 at 2:11 PM, Dalia Sobhy <dalia.mohsobhy@hotmail.com
> > >wrote:
> > >
> > > >
> > > > Dear all,
> > > >
> > > > I want to use the aggregate functions, but do anyone have a code or
> > sth to
> > > > understand them ..
> > > >
> > > > Thanks
> > > >
> > > > Best Regards
> > > > Dalia
> > > >
> >
> >
 		 	   		  

Re: Question

Posted by Ted Yu <yu...@gmail.com>.
Dalia:
If you look at:
public interface ColumnInterpreter<T, S> {

you would see:
 * @param <T> Cell value data type
 * @param <S> Promoted data type

S can represent sum of values of T. The rationale was that aggregation of
one type (integer, e.g.) may have to be represented by another type
(double, e.g.)

>From this blog you can get some history on this subject:
http://zhihongyu.blogspot.com/2011/03/genericizing-endpointcoprocessor.html

For row counting, it is already implemented:
  public <T, S> long getRowNum(ColumnInterpreter<T, S> ci, Scan scan)
You can embed your filter in scan object.

Cheers

On Sun, Nov 11, 2012 at 8:07 AM, Dalia Sobhy <da...@hotmail.com>wrote:

>
>
> Thanks Ted :D
>
> But can anyone explain to me this sentence:
>
> ColumnInterpreter<T, S> ci
>
> How to set a ColumnInterpreter ?? What is T and Whats S?
>
> I want to perform average on an Aggregationclient, so could anyone provide
> me with a sample code?
>
> Also if i want to count the number of rows which has a specific value ?
> What to use Filters or AggregationClient?
>
> Thanks in advance,
>
> > Date: Sat, 10 Nov 2012 14:25:22 -0800
> > Subject: Re: Question
> > From: yuzhihong@gmail.com
> > To: user@hbase.apache.org
> >
> > Take a look at AggregationClient.java and TestAggregateProtocol.java
> >
> > Cheers
> >
> > On Sat, Nov 10, 2012 at 2:11 PM, Dalia Sobhy <dalia.mohsobhy@hotmail.com
> >wrote:
> >
> > >
> > > Dear all,
> > >
> > > I want to use the aggregate functions, but do anyone have a code or
> sth to
> > > understand them ..
> > >
> > > Thanks
> > >
> > > Best Regards
> > > Dalia
> > >
>
>

RE: Question

Posted by Dalia Sobhy <da...@hotmail.com>.

Thanks Ted :D

But can anyone explain to me this sentence:

ColumnInterpreter<T, S> ci

How to set a ColumnInterpreter ?? What is T and Whats S?

I want to perform average on an Aggregationclient, so could anyone provide me with a sample code?

Also if i want to count the number of rows which has a specific value ? What to use Filters or AggregationClient?

Thanks in advance,

> Date: Sat, 10 Nov 2012 14:25:22 -0800
> Subject: Re: Question
> From: yuzhihong@gmail.com
> To: user@hbase.apache.org
> 
> Take a look at AggregationClient.java and TestAggregateProtocol.java
> 
> Cheers
> 
> On Sat, Nov 10, 2012 at 2:11 PM, Dalia Sobhy <da...@hotmail.com>wrote:
> 
> >
> > Dear all,
> >
> > I want to use the aggregate functions, but do anyone have a code or sth to
> > understand them ..
> >
> > Thanks
> >
> > Best Regards
> > Dalia
> >
 		 	   		  

Re: Question

Posted by Ted Yu <yu...@gmail.com>.
Take a look at AggregationClient.java and TestAggregateProtocol.java

Cheers

On Sat, Nov 10, 2012 at 2:11 PM, Dalia Sobhy <da...@hotmail.com>wrote:

>
> Dear all,
>
> I want to use the aggregate functions, but do anyone have a code or sth to
> understand them ..
>
> Thanks
>
> Best Regards
> Dalia
>