You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by dyuti a <ha...@gmail.com> on 2012/10/22 10:41:11 UTC

help in hive

Hi all,
 I have a hive table with  235 million records.

SAMPLE INPUT:
receive_year    receive_day     receive_hour       client
         2012                       7                             17
             xyz
         2012                       7                             02
             xyz
         2012                       7                             17
             btn
         2012                       7                             04
             snm
         2012                       7                             05
             btn
         2012                       7                             02
             snm

receive_hour is an int field having values from 01 to 24 (transaction
received hour in 24 hour basis).

EXPECTED OUTPUT:

The transaction received per hour basis i.e., 01 (start_time) t0 02
(end_time) . so that the receive_hour column should be displayed as
start_time and end_time so that every one hour transaction received for
particular client on that day.

client      receive_day      start_time       end_time
   xyz                7                           01
 02
   xyz                7                           02
 03
   xyz                7                           03
 04
  continues up to                     23                         24

like the same for other clients too.

am facing problem in displaying the single column values into two column in
hive. i.e., 1 - 2 , 2- 3 ............. 23 - 24.

I have written the query to display the other details happened in
transaction but got stuck in the above scenario.

Please let me know is this possible in hive, if so then pls guide me.


Thanks for your help in advance!


Regards,
dti

Re: help in hive

Posted by dyuti a <ha...@gmail.com>.
Hi,
Thank you so much for your help. It works great.

Regards,
dti

On Mon, Oct 22, 2012 at 2:18 PM, MiaoMiao <li...@gmail.com> wrote:

> Try
>
> SELECT
> client, receive_day, receive_hour as start_time, receive_hour+1 as end_time
> FROM some_table
> WHERE client='xyz' AND receive_day=7
> ORDER BY start_time;
>
> On Mon, Oct 22, 2012 at 4:41 PM, dyuti a <ha...@gmail.com> wrote:
> > Hi all,
> >  I have a hive table with  235 million records.
> >
> > SAMPLE INPUT:
> > receive_year    receive_day     receive_hour       client
> >          2012                       7                             17
> > xyz
> >          2012                       7                             02
> > xyz
> >          2012                       7                             17
> > btn
> >          2012                       7                             04
> > snm
> >          2012                       7                             05
> > btn
> >          2012                       7                             02
> > snm
> >
> > receive_hour is an int field having values from 01 to 24 (transaction
> > received hour in 24 hour basis).
> >
> > EXPECTED OUTPUT:
> >
> > The transaction received per hour basis i.e., 01 (start_time) t0 02
> > (end_time) . so that the receive_hour column should be displayed as
> > start_time and end_time so that every one hour transaction received for
> > particular client on that day.
> >
> > client      receive_day      start_time       end_time
> >    xyz                7                           01
> > 02
> >    xyz                7                           02
> > 03
> >    xyz                7                           03
> > 04
> >   continues up to                     23                         24
> >
> > like the same for other clients too.
> >
> > am facing problem in displaying the single column values into two column
> in
> > hive. i.e., 1 - 2 , 2- 3 ............. 23 - 24.
> >
> > I have written the query to display the other details happened in
> > transaction but got stuck in the above scenario.
> >
> > Please let me know is this possible in hive, if so then pls guide me.
> >
> >
> > Thanks for your help in advance!
> >
> >
> > Regards,
> > dti
> >
> >
> >
> >
> >
>

Re: help in hive

Posted by MiaoMiao <li...@gmail.com>.
Try

SELECT
client, receive_day, receive_hour as start_time, receive_hour+1 as end_time
FROM some_table
WHERE client='xyz' AND receive_day=7
ORDER BY start_time;

On Mon, Oct 22, 2012 at 4:41 PM, dyuti a <ha...@gmail.com> wrote:
> Hi all,
>  I have a hive table with  235 million records.
>
> SAMPLE INPUT:
> receive_year    receive_day     receive_hour       client
>          2012                       7                             17
> xyz
>          2012                       7                             02
> xyz
>          2012                       7                             17
> btn
>          2012                       7                             04
> snm
>          2012                       7                             05
> btn
>          2012                       7                             02
> snm
>
> receive_hour is an int field having values from 01 to 24 (transaction
> received hour in 24 hour basis).
>
> EXPECTED OUTPUT:
>
> The transaction received per hour basis i.e., 01 (start_time) t0 02
> (end_time) . so that the receive_hour column should be displayed as
> start_time and end_time so that every one hour transaction received for
> particular client on that day.
>
> client      receive_day      start_time       end_time
>    xyz                7                           01
> 02
>    xyz                7                           02
> 03
>    xyz                7                           03
> 04
>   continues up to                     23                         24
>
> like the same for other clients too.
>
> am facing problem in displaying the single column values into two column in
> hive. i.e., 1 - 2 , 2- 3 ............. 23 - 24.
>
> I have written the query to display the other details happened in
> transaction but got stuck in the above scenario.
>
> Please let me know is this possible in hive, if so then pls guide me.
>
>
> Thanks for your help in advance!
>
>
> Regards,
> dti
>
>
>
>
>