Tuesday 9 June 2015

Passing variables from shell script to hive script


I have a hive script which might have some variables like table-name, count, etc to make it more generic and automated.

$ cat hive-test.hql
select count(*) from demodb.demo_table limit ${hiveconf:num}

Creating a shell script to execute above hive script and passing required variables to it.

$ cat script-test.sh
# /bin/bash
count=5
hive -hiveconf num="$cnt" -f hive-test.hql





No comments:

Post a Comment