繁体   English   中英

我需要从分区表 (Hive) 进行备份

[英]I need to make backup from partitioned table (Hive)

我需要从超过 500 个分区的分区表中备份数据。 我的表按 date_part 分区,如“date_part = 20221101”或“date_part = 20221102”等。我需要从 20221101 到 20221130 进行 30 个分区,并复制到另一个新的备份表。

如果我这样做:

create table <backup_table> as
select * from <data_table> where date_part between 20221101 and 20221130

在 output,我得到未分区的 <backup_table> 和 idk 是不是好方法,但我想分区的 <backup_table> 会更好。

如果我尝试这样做:

create table <bacup_table> like <data_table>;
insert overwrite table <backup_table> partition (`date_part`)
select * from <data_table> where date_part between 20221101 and 20221130;

在 output,我收到类似需要指定分区列的错误...

如果我 go 另一种方式:

create table <bacup_table> like <data_table>;
insert overwrite table <backup_table> partition (`date_part`)
select field1, field2...,
date_part
from <data_table> where date_part between 20221101 and 20221130;

我收到另一个错误,例如“运行查询时出错”或“...nonstrick 模式...”或其他错误。 我已经尝试了很多 hive 设置,但它仍然不起作用:(

这就是为什么我需要你的帮助才能正确地做到这一点。

启用动态分区并复制数据。

SET hive.exec.dynamic.partition = true;
SET hive.exec.dynamic.partition.mode = nonstrict;
SET hive.mapred.mode = nonstrict;

暂无
暂无

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

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