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

Switch to Plain View
Hive, mail # user - load data inot hive using shell script


+
prabhu k 2012-08-09, 13:57
Copy link to this message
-
Re: load data inot hive using shell script
Jan Dolinár 2012-08-09, 14:02
I'd suggest you to read a bit about shell scripts... To make this work you
have to pass the queries to the hive via -e option. The way you wrote it,
interactive cli would be run and the queries would be attempted to be
executed by shell when cli ends. The correct skript in your case shouild
look like this:

export HADOOP_HOME=/usr/local/hadoop
bin/hive -e "load data local inpath
'/usr/local/hadoop_dir/hadoop/input/sample.txt' overwrite into table
sample;"

Note that 'exit' is not even necessary, hive will exit when it reaches end
of the last statement supplied.

Best regards,
Jan
On Thu, Aug 9, 2012 at 3:57 PM, prabhu k <[EMAIL PROTECTED]> wrote:

> Hi Users,
>
> I m trying to load data into hive table using shell script. unable to load
> data into hive table.
>
> *sample.sh*
> export HADOOP_HOME=/usr/local/hadoop
> bin/hive
> load data local inpath '/usr/local/hadoop_dir/hadoop/input/sample.txt'
> overwrite into table sample;
> exit;
>
> Please suggest and help me.
>
> Thanks,
> Prabhu
>
+
prabhu k 2012-08-09, 14:18