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

Switch to Plain View
Hive >> mail # user >> Re: Loading a flat file + one additional field to a Hive table


+
manishbhoge@...) 2013-07-05, 17:39
Copy link to this message
-
Re: Loading a flat file + one additional field to a Hive table
How about this ?

Assume you have a log file called
oompaloompa.log

TIMESTAMP=$(date +%Y_%m_%d_T%H_%M_%S);mv oompaloopa.log oompaloopa.log.${TIMESTAMP};cat oompaloopa.log.${TIMESTAMP}| hdfs dfs -put - /user/sasubramanian/oompaloopa.log.${TIMESTAMP}

This will directly put the file on HDFS and u can put it to the LOCATION specified by your HIVE TABLE definition

sanjay
From: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Reply-To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Date: Friday, July 5, 2013 10:39 AM
To: Raj Hadoop <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>, Hive <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Subject: Re: Loading a flat file + one additional field to a Hive table

Raj,

You should dump the data in a temp table first and then move the data into final table with select query.
Select date(), c1,c2..... From temp table.
Reason: we should avoid custom operation in load unless it is necessary.
Sent via Rocket from my HTC

----- Reply message -----
From: "Raj Hadoop" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
To: "Hive" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Subject: Loading a flat file + one additional field to a Hive table
Date: Fri, Jul 5, 2013 10:30 PM
Hi,

Can any one please suggest the best way to do the following in Hive?

Load 'todays date stamp' + << ALL FIELDS C1,C2,C3,C4 IN A FILE F1 >> to a Hive table  T1 ( D1,C1,C2,C3,C4)

    Can the following command be modified in some way to acheive the above
    hive > load data local inpath '/software/home/hadoop/dat_files/' into table T1;

My requirement is to append a date stamp to a Web log file and then load it to Hive table.

Thanks,
Raj

CONFIDENTIALITY NOTICE
=====================This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.
+
Raj Hadoop 2013-07-05, 22:27
+
Sanjay Subramanian 2013-07-06, 07:51
+
Raj Hadoop 2013-07-05, 17:00