所有
希望将变量从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"
请注意,它是shell中的hive命令。
然后我正在运行它以获得oozie:
${wf:actionData('getPartitions')['evaldate']}
但它每次都是空白!我可以在我的shell中运行这些命令很好,它似乎工作,但oozie没有。同样,如果我在群集的其他框上运行命令,它们也可以正常运行。有什么想法吗?
答案 0 :(得分:2)
问题是关于我的群集的配置。当我作为oozie用户运行时,我向/ tmp / yarn写了权限问题。有了这个,我将命令改为运行:
baais =“export HADOOP_USER_NAME = functionalid; hive yarn -hiveconf hive.execution.engine = mr -e'从db.table选择max(cast(create_date as int));'”
hive允许我以纱线的形式运行。
答案 1 :(得分:0)
问题的解决方案是使用" -S"在hive命令中切换静默输出。 (见下文)
另外," evalBaais"?您可能需要将其替换为" evalDate"。所以你的代码应该是这样的 -
#!/bin/sh
evalDate="hive -S -e 'set hive.execution.engine=mr; select max(cast(create_date as int)) from db.table;'"
evalPartition=$(eval $evalDate)
echo "evaldate=$evalPartition"
现在你应该能够抓住它了。