Great !  I will try it.

Best Regards,
Jumping Qu


On Thu, Feb 25, 2010 at 3:35 PM, Jeff Zhang <[email protected]> wrote:

> Is this what you want ?
>
>
> A = LOAD 'data/input' USING PigStorage(',') AS
> (name:chararray, aa:float, bb:float, cc:float, dd:float);
>
> B = FILTER A BY cc > 0;
> C = GROUP B BY name;
> D = FOREACH C GENERATE group,SUM(B.cc)/SUM(B.aa)/SUM(B.bb) as allsum;
>
> E = JOIN B By name,D BY group;
>
> F = FOREACH E GENERATE name,cc*dd/allsum;
> DUMP F;
>
>
> On Thu, Feb 25, 2010 at 3:04 PM, Jumping <[email protected]> wrote:
>
> > Hi Jeff,
> >
> > Thank you for your reply so quickly.
> > I would like to  do calculations (cc * dd) * SUM (cc) / SUM (B.aa) / SUM
> > (B.bb) on  1.csv.
> >
> >
> > Best Regards,
> > Jumping Qu
> >
> > On Thu, Feb 25, 2010 at 2:50 PM, Jeff Zhang <[email protected]> wrote:
> >
> > > I am not quit understand your script. For each D there is a allSum, so
> > what
> > > is the relationship between B and allSum in your last statement.
> > >
> > >
> > >
> > > On Thu, Feb 25, 2010 at 2:33 PM, Jumping <[email protected]>
> wrote:
> > >
> > > > Hi,
> > > > I have this script, how to achive results ?
> > > >
> > > >
> > > >
> > > >
> > >
> >
> ====================================================================================
> > > > A = LOAD 'file:///home/hadoop/1.csv' USING PigStorage(',') AS
> > > > (name:chararray, aa:float, bb:float, cc:float, dd:float);
> > > >
> > > > B = FILTER A BY cc > 0;
> > > >
> > > > C = GROUP B BY name;
> > > >
> > > > D = FOREACH C GENERATE group,
> > > > SUM(B.cc)/SUM(B.aa)/SUM(B.bb) as allsum;
> > > >
> > > > E= FOREACH B GENERATE cc*dd/allsum;
> > > >
> > > >
> > >
> >
> =====================================================================================
> > > >
> > > >
> > > > The last one could not work.
> > > >
> > > > Looking forward to experts input. Thanks.
> > > >
> > > >
> > > > Best Regards,
> > > > Jumping Qu
> > > >
> > >
> > >
> > >
> > > --
> > > Best Regards
> > >
> > > Jeff Zhang
> > >
> >
>
>
>
> --
> Best Regards
>
> Jeff Zhang
>

Reply via email to