Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive, mail # user - help in hive


+
dyuti a 2012-10-22, 08:41
Copy link to this message
-
Re: help in hive
MiaoMiao 2012-10-22, 08:48
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 <[EMAIL PROTECTED]> 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
>
>
>
>
>
+
dyuti a 2012-10-22, 12:20