2016-08-16 100 views
0

我想在shell腳本中運行hive查詢。如果我的配置單元查詢失敗,我想退出shell腳本並拋出錯誤。 現在,即使我的配置單元查詢失敗,接下來的步驟也會執行。有人可以幫助解決這個:shell腳本中的hive查詢

VAL = hive -e " select col1 from table_name;" (假設表只有一行)

回聲「如果蜂巢失敗不跑」

+0

怎麼樣使用的Oozie的工作流程配置單元命令執行和處理失敗 - https://gist.github.com/tmusabbir/7019600 – Aditya

回答

1
hive -e "select col1 from table_name" 

if test $? -ne 0 
then 
    exit 1 
fi