Search code examples
shellhiveoozie

Need to pass Variable from Shell Action to Oozie Shell using Hive


All,

Looking to pass variable from shell action to the oozie shell. I am running commands such as this, in my script:

#!/bin/sh
evalDate="hive -e 'set hive.execution.engine=mr; select     max(cast(create_date as int)) from db.table;'"
evalPartition=$(eval $evalBaais)
echo "evaldate=$evalPartition"

Trick being that it is a hive command in the shell.

Then I am running this to get it in oozie:

${wf:actionData('getPartitions')['evaldate']}

But it pulls a blank every time! I can run those commands in my shell fine and it seems to work but oozie does not. Likewise, if I run the commands on the other boxes of the cluster, they run fine as well. Any ideas?


Solution

  • The issue was configuration regarding to my cluster. When I ran as oozie user, I had write permission issues to /tmp/yarn. With that, I changed the command to run as:

    baais="export HADOOP_USER_NAME=functionalid; hive yarn -hiveconf hive.execution.engine=mr -e 'select max(cast(create_date as int)) from db.table;'"

    Where hive allows me to run as yarn.