需要使用Hive将Shell Action中的变量传递给Oozie Shell

the*_*f91 5 shell hive oozie

所有,

希望将变量从shell动作传递给oozie shell.我在我的脚本中运行这样的命令:

#!/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"
Run Code Online (Sandbox Code Playgroud)

诀窍是它是shell中的hive命令.

然后我运行它来获取它在oozie中:

${wf:actionData('getPartitions')['evaldate']}
Run Code Online (Sandbox Code Playgroud)

但它每次都是空白!我可以在我的shell中运行这些命令很好,它似乎工作,但oozie没有.同样,如果我在群集的其他框上运行命令,它们也可以正常运行.有任何想法吗?

the*_*f91 2

问题是关于我的集群的配置。当我以 oozie 用户身份运行时,我遇到了 /tmp/yarn 的写入权限问题。这样,我将命令更改为运行:

baais =“导出HADOOP_USER_NAME =功能ID; hive纱线-hiveconf hive.execution.engine = mr -e'从db.table中选择max(cast(create_date as int));'”

hive 允许我作为纱线运行。