hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan DolinĂ¡r <dolik....@gmail.com>
Subject Re: load data inot hive using shell script
Date Thu, 09 Aug 2012 14:02:34 GMT
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 <prabhu.hive@gmail.com> 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
>

Mime
View raw message