hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Praveen Kumar <praveenshett...@gmail.com>
Subject Re: Date,table name as config parameter from command prompt in Hive queries
Date Wed, 11 Jan 2012 10:14:00 GMT
I found one way of doing it but, failing in that.

hive_query.hql
--------------
use db_name;
select * from ( select * from '${hiveconf:tab_name1}' union all select *
from '${hiveconf: tab_name2}') t1
where sdate > '${hiveconf: curr_date1}' and edate < '${hiveconf:
curr_date2}';

hive_tri.sh
-------------
TABLE_NAME1=$1
TABLE_NAME2=$2
CURRENT_DATE1=$3
CURRENT_DATE2=$4
hive -f hive_query.hql -hiveconf tab_name1=TABLE_NAME1 -hiveconf
tab_name2=TABLE_NAME2 -hiveconf curr_date1=CURRENT_DATE1 -hiveconf
curr_date2=CURRENT_DATE2


from prompt I am running below query,

$ ./hive_tri.sh temp_table real_table 2011-12-10 2011-12-23


But, after running above command I am getting error:
FAILED: Parse Error: line 2:31 cannot recognize input ''TABLE_NAME1'' in
join source

please help where I it is going wrong

Thanks
Praveen



On Wed, Jan 11, 2012 at 3:15 PM, Praveen Kumar <praveenshettysn@gmail.com>wrote:

> Hello,
>
> I want to run hive queries through a .hql file in command prompt where i
> need to pass start_date,end_date & table_name as command line parameter
> How can I achieve this?
> Please help
>
> --
>
> Regards,
> Praveen
>



-- 

Regards,
Praveen

Mime
View raw message