HIVE: hive.error.on.empty.partition

參考地址:http://www.88cto.com/996962/article/details/32652.html html

默認狀況下動態分區插入是禁用的,下表是關於動態分區插入的相關配置屬性: python

配置參數 shell

默認值 編程

描述 spa

hive.error.on.empty.partition htm

false ci

在動態分區插入產生空結果時是否拋出異常。 cmd

hive.exec.dynamic.partition it

false io

是否容許動態分區插入,若容許則設置爲true。

hive.exec.dynamic.partition.mode

strict

在strict模式 中用戶至少指定一個靜態分區以防用戶不慎覆蓋全部分區,在nonstrict模式中全部分區都容許是動態的。

   

實際項目編程案例:

若是設置: 

set hive.exec.dynamic.partition.mode=nonstrict;  設置動態分區

set hive.error.on.empty.partition=true;  那麼動態分區若是爲空,則會報異常。 很是實用~

可使用 python subprocess 模塊:

execute_hql 表示你要執行的 hql 語句

例如: cmd_result = subprocess.call(execute_hql, shell=True)

返回值 0 正常,其餘值異常。

~ 謝謝分享

相關文章
相關標籤/搜索