You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by yo...@wipro.com on 2012/09/29 13:22:29 UTC

FW: how to perform GROUP BY:: in pig for this


Hi all,

I have this data, having fields  (Date, symbol, rate)

and I want it to be group by Months, and to find out the maximum rate value for each month.

like: for month (08, 36.3), (09, 36.4), (10, 36.8), (11, 37.5) ..


(2009-08-21,CLI,33.38)
(2009-08-24,CLI,33.03)
(2009-08-25,CLI,33.16)
(2009-08-26,CLI,32.78)
(2009-08-27,CLI,32.79)
(2009-08-28,CLI,33.37)
(2009-08-31,CLI,32.51)
(2009-09-11,CLI,34.08)
(2009-09-14,CLI,35.19)
(2009-09-15,CLI,35.82)
(2009-09-16,CLI,36.58)
(2009-09-17,CLI,37.63)
(2009-09-18,CLI,37.26)
(2009-09-21,CLI,36.31)
(2009-09-22,CLI,35.88)
(2009-09-23,CLI,35.84)
(2009-09-24,CLI,33.98)
(2009-09-25,CLI,32.44)
(2009-09-28,CLI,33.34)
(2009-09-29,CLI,33.6)
(2009-09-30,CLI,33.24)
(2009-10-01,CLI,31.98)
(2009-10-02,CLI,31.21)
(2009-10-05,CLI,31.31)
(2009-10-21,CLI,32.86)
(2009-10-26,CLI,33.15)
(2009-10-27,CLI,32.71)
(2009-10-28,CLI,32.03)
(2009-10-29,CLI,32.05)
(2009-10-30,CLI,31.88)
(2009-11-02,CLI,31.88)
(2009-11-03,CLI,31.16)
(2009-11-04,CLI,31.47)
(2009-11-09,CLI,31.59)
(2009-11-25,CLI,30.58)
(2009-11-27,CLI,30.19)
(2009-11-30,CLI,30.86)
(2009-12-01,CLI,31.74)
(2009-12-02,CLI,32.62)
(2009-12-03,CLI,33.43)
(2009-12-04,CLI,34.12)
(2009-12-07,CLI,33.77)
(2009-12-08,CLI,33.8)
(2009-12-09,CLI,33.71)

Please help and suggest .

Thanks & Regards
Yogesh Kumar

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Fwd: how to perform GROUP BY:: in pig for this

Posted by Russell Jurney <ru...@gmail.com>.
I find it bad that this was so much easier for him in Hive than Pig (cross
posted question), but it looks like the datetime type and it's builtins
would fix this.

Russell Jurney
twitter.com/rjurney
russell.jurney@gmail.com
datasyndrome.com

Begin forwarded message:

*From:* yogesh dhari <yo...@live.com>
*Date:* September 30, 2012 6:53:52 AM PDT
*To:* hive request <us...@hive.apache.org>
*Subject:* *RE: how to perform GROUP BY:: in pig for this*
*Reply-To:* user@hive.apache.org


Thanks Bejoy :-)

Regards
Yogesh Kumar
------------------------------
From: bejoyks@outlook.com
To: user@hive.apache.org
Subject: RE: how to perform GROUP BY:: in pig for this
Date: Sun, 30 Sep 2012 18:57:55 +0530

 Hi Yogesh

If you are looking for the solution in hive, then the following query will
get you the required result

Select month(Date), max(rate) from date_sample Group BY month(Date);


Regards
Bejoy KS



> From: yogesh.kumar13@wipro.com
> To: user@hive.apache.org
> CC: Yogeshdhari@live.com
> Subject: FW: how to perform GROUP BY:: in pig for this
> Date: Sat, 29 Sep 2012 11:22:29 +0000
>
>
>
> Hi all,
>
> I have this data, having fields (Date, symbol, rate)
>
> and I want it to be group by Months, and to find out the maximum rate
value for each month.
>
> like: for month (08, 36.3), (09, 36.4), (10, 36.8), (11, 37.5) ..
>
>
> (2009-08-21,CLI,33.38)
> (2009-08-24,CLI,33.03)
> (2009-08-25,CLI,33.16)
> (2009-08-26,CLI,32.78)
> (2009-08-27,CLI,32.79)
> (2009-08-28,CLI,33.37)
> (2009-08-31,CLI,32.51)
> (2009-09-11,CLI,34.08)
> (2009-09-14,CLI,35.19)
> (2009-09-15,CLI,35.82)
> (2009-09-16,CLI,36.58)
> (2009-09-17,CLI,37.63)
> (2009-09-18,CLI,37.26)
> (2009-09-21,CLI,36.31)
> (2009-09-22,CLI,35.88)
> (2009-09-23,CLI,35.84)
> (2009-09-24,CLI,33.98)
> (2009-09-25,CLI,32.44)
> (2009-09-28,CLI,33.34)
> (2009-09-29,CLI,33.6)
> (2009-09-30,CLI,33.24)
> (2009-10-01,CLI,31.98)
> (2009-10-02,CLI,31.21)
> (2009-10-05,CLI,31.31)
> (2009-10-21,CLI,32.86)
> (2009-10-26,CLI,33.15)
> (2009-10-27,CLI,32.71)
> (2009-10-28,CLI,32.03)
> (2009-10-29,CLI,32.05)
> (2009-10-30,CLI,31.88)
> (2009-11-02,CLI,31.88)
> (2009-11-03,CLI,31.16)
> (2009-11-04,CLI,31.47)
> (2009-11-09,CLI,31.59)
> (2009-11-25,CLI,30.58)
> (2009-11-27,CLI,30.19)
> (2009-11-30,CLI,30.86)
> (2009-12-01,CLI,31.74)
> (2009-12-02,CLI,32.62)
> (2009-12-03,CLI,33.43)
> (2009-12-04,CLI,34.12)
> (2009-12-07,CLI,33.77)
> (2009-12-08,CLI,33.8)
> (2009-12-09,CLI,33.71)
>
> Please help and suggest .
>
> Thanks & Regards
> Yogesh Kumar
>
> The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s) and
may contain proprietary, confidential or privileged information. If you are
not the intended recipient, you should not disseminate, distribute or copy
this e-mail. Please notify the sender immediately and destroy all copies of
this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
>
> www.wipro.com

RE: how to perform GROUP BY:: in pig for this

Posted by yogesh dhari <yo...@live.com>.

Thanks Bejoy :-)

Regards
Yogesh Kumar
From: bejoyks@outlook.com
To: user@hive.apache.org
Subject: RE: how to perform GROUP BY:: in pig for this
Date: Sun, 30 Sep 2012 18:57:55 +0530




Hi Yogesh

If you are looking for the solution in hive, then the following query will get you the required result

Select month(Date), max(rate) from date_sample Group BY month(Date);


Regards
Bejoy KS



> From: yogesh.kumar13@wipro.com
> To: user@hive.apache.org
> CC: Yogeshdhari@live.com
> Subject: FW: how to perform GROUP BY:: in pig for this
> Date: Sat, 29 Sep 2012 11:22:29 +0000
> 
> 
> 
> Hi all,
> 
> I have this data, having fields  (Date, symbol, rate)
> 
> and I want it to be group by Months, and to find out the maximum rate value for each month.
> 
> like: for month (08, 36.3), (09, 36.4), (10, 36.8), (11, 37.5) ..
> 
> 
> (2009-08-21,CLI,33.38)
> (2009-08-24,CLI,33.03)
> (2009-08-25,CLI,33.16)
> (2009-08-26,CLI,32.78)
> (2009-08-27,CLI,32.79)
> (2009-08-28,CLI,33.37)
> (2009-08-31,CLI,32.51)
> (2009-09-11,CLI,34.08)
> (2009-09-14,CLI,35.19)
> (2009-09-15,CLI,35.82)
> (2009-09-16,CLI,36.58)
> (2009-09-17,CLI,37.63)
> (2009-09-18,CLI,37.26)
> (2009-09-21,CLI,36.31)
> (2009-09-22,CLI,35.88)
> (2009-09-23,CLI,35.84)
> (2009-09-24,CLI,33.98)
> (2009-09-25,CLI,32.44)
> (2009-09-28,CLI,33.34)
> (2009-09-29,CLI,33.6)
> (2009-09-30,CLI,33.24)
> (2009-10-01,CLI,31.98)
> (2009-10-02,CLI,31.21)
> (2009-10-05,CLI,31.31)
> (2009-10-21,CLI,32.86)
> (2009-10-26,CLI,33.15)
> (2009-10-27,CLI,32.71)
> (2009-10-28,CLI,32.03)
> (2009-10-29,CLI,32.05)
> (2009-10-30,CLI,31.88)
> (2009-11-02,CLI,31.88)
> (2009-11-03,CLI,31.16)
> (2009-11-04,CLI,31.47)
> (2009-11-09,CLI,31.59)
> (2009-11-25,CLI,30.58)
> (2009-11-27,CLI,30.19)
> (2009-11-30,CLI,30.86)
> (2009-12-01,CLI,31.74)
> (2009-12-02,CLI,32.62)
> (2009-12-03,CLI,33.43)
> (2009-12-04,CLI,34.12)
> (2009-12-07,CLI,33.77)
> (2009-12-08,CLI,33.8)
> (2009-12-09,CLI,33.71)
> 
> Please help and suggest .
> 
> Thanks & Regards
> Yogesh Kumar
> 
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 
> 
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
> 
> www.wipro.com
 		 	   		   		 	   		  

RE: how to perform GROUP BY:: in pig for this

Posted by Bejoy KS <be...@outlook.com>.
Hi Yogesh

If you are looking for the solution in hive, then the following query will get you the required result

Select month(Date), max(rate) from date_sample Group BY month(Date);


Regards
Bejoy KS



> From: yogesh.kumar13@wipro.com
> To: user@hive.apache.org
> CC: Yogeshdhari@live.com
> Subject: FW: how to perform GROUP BY:: in pig for this
> Date: Sat, 29 Sep 2012 11:22:29 +0000
> 
> 
> 
> Hi all,
> 
> I have this data, having fields  (Date, symbol, rate)
> 
> and I want it to be group by Months, and to find out the maximum rate value for each month.
> 
> like: for month (08, 36.3), (09, 36.4), (10, 36.8), (11, 37.5) ..
> 
> 
> (2009-08-21,CLI,33.38)
> (2009-08-24,CLI,33.03)
> (2009-08-25,CLI,33.16)
> (2009-08-26,CLI,32.78)
> (2009-08-27,CLI,32.79)
> (2009-08-28,CLI,33.37)
> (2009-08-31,CLI,32.51)
> (2009-09-11,CLI,34.08)
> (2009-09-14,CLI,35.19)
> (2009-09-15,CLI,35.82)
> (2009-09-16,CLI,36.58)
> (2009-09-17,CLI,37.63)
> (2009-09-18,CLI,37.26)
> (2009-09-21,CLI,36.31)
> (2009-09-22,CLI,35.88)
> (2009-09-23,CLI,35.84)
> (2009-09-24,CLI,33.98)
> (2009-09-25,CLI,32.44)
> (2009-09-28,CLI,33.34)
> (2009-09-29,CLI,33.6)
> (2009-09-30,CLI,33.24)
> (2009-10-01,CLI,31.98)
> (2009-10-02,CLI,31.21)
> (2009-10-05,CLI,31.31)
> (2009-10-21,CLI,32.86)
> (2009-10-26,CLI,33.15)
> (2009-10-27,CLI,32.71)
> (2009-10-28,CLI,32.03)
> (2009-10-29,CLI,32.05)
> (2009-10-30,CLI,31.88)
> (2009-11-02,CLI,31.88)
> (2009-11-03,CLI,31.16)
> (2009-11-04,CLI,31.47)
> (2009-11-09,CLI,31.59)
> (2009-11-25,CLI,30.58)
> (2009-11-27,CLI,30.19)
> (2009-11-30,CLI,30.86)
> (2009-12-01,CLI,31.74)
> (2009-12-02,CLI,32.62)
> (2009-12-03,CLI,33.43)
> (2009-12-04,CLI,34.12)
> (2009-12-07,CLI,33.77)
> (2009-12-08,CLI,33.8)
> (2009-12-09,CLI,33.71)
> 
> Please help and suggest .
> 
> Thanks & Regards
> Yogesh Kumar
> 
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 
> 
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
> 
> www.wipro.com