0
如何执行echo & if .hql(hive)文件中的其他内容?echo&if else .hql(HIVE)文件
我能够执行回声像下面:
!echo "test";
但是不能像下面的执行“的if-else”。
!if [ 1=1] then
!echo "if is working"
!else
!echo "not working"
!fi
谢谢
如何执行echo & if .hql(hive)文件中的其他内容?echo&if else .hql(HIVE)文件
我能够执行回声像下面:
!echo "test";
但是不能像下面的执行“的if-else”。
!if [ 1=1] then
!echo "if is working"
!else
!echo "not working"
!fi
谢谢
我觉得!
可以在单个命令中使用。运行多行脚本将其放入shell脚本并运行。
Unix_prompt$ cat script.sh
if [ 1=1 ]
then
echo "if is working"
else
echo "not working"
fi
HIVE> !./script.sh;
我也这么做了。不是将它作为单个命令运行。我将代码保存在一个shell脚本中,并以扩展名.hql文件保存并运行。但是if-else没有运气。 – Data
我觉得问题不在于'HIVE'。你的if条件在'']'之前没有空格',那么'then'应该在下一行。 –