In Oozie, I have used Hive action in Hue, same action I used parameter options to supply date parameter. Here I want to provide dynamic date parameter such as yesterday date and day before yesterday. How can I generate those date? and how can I pass as parameter.
My HQL is :
CREATE TABLE IF NOT EXISTS tmp_table as
select * from emptable
where day>=${fromdate} and day<=${todate}
My HiveServer Action contains: a. HQL script b. Two parameters options one for each dates like as fromdate = , todate = c. Added file option for HQL script.
What I tried: I created two separate shell scripts which returns date. One of Shell script is
#! /bin/bash
FROM_DAY=$(date +%Y-%m-%d -d " - 1 day")
echo "$FROM_DAY"
and hive action parameter become fromdate = /user/manishs/Oozie/filter.sh
However this approach is not working and gives exceptions: Error: Error while compiling statement: FAILED: ParseException line 4:11 cannot recognize input near '/' 'user' '/' in expression specification (state=42000,code=40000)
NOTE: If I pass a date as : fromdate ='2015-08-01' , it is working and give results.
My question is how can I pass a dynamic date in a hive server action as a parameter. OR Is any way to pass dynamic filter to a query.