Is there a way to prevent a Hive table from being overwritten if the SELECT query of the INSERT OVERWRITE does not return any results

本秂侑毒 提交于 2019-12-04 17:56:52

Try to add dummy partition to your table, say LOAD_TAG and use dynamic partition load:

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;

INSERT OVERWRITE TABLE your_table PARTITION(LOAD_TAG)
select
      col1,
      ...
      colN,
      'dummy_value' as LOAD_TAG
  from source_table;

The partition value should always be the same in your case.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!