简体   繁体   English

外壳脚本中的配置单元查询

[英]hive query inside shell script

I want to run the hive query inside the shell script. 我想在shell脚本中运行配置单元查询。 I want to exit shell script and throw error if my hive query fails. 如果我的配置单元查询失败,我想退出shell脚本并抛出错误。 Right now, even if my hive query fails, the next steps are getting executed. 现在,即使我的配置单元查询失败,也将继续执行后续步骤。 can someone help with this: 有人可以帮忙吗:

val= hive -e " select col1 from table_name;" val = hive -e " select col1 from table_name;" (assuming the table has only one row) (假设表只有一行)

echo "don't run if hive fails" 回声“如果配置单元失败,请不要运行”

hive -e "select col1 from table_name"

if test $? -ne 0
then 
    exit 1
fi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM