Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

shell

hive

oozie

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?

like image 754
theMJof91 Avatar asked Oct 31 '22 01:10

theMJof91


1 Answers

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.

like image 119
theMJof91 Avatar answered Jan 04 '23 15:01

theMJof91