hive 分区表 添加新字段 查询为NULL的情况 我也遇到了这个问题

来源:互联网 发布:肖凯农村淘宝 编辑:程序博客网 时间:2024/05/21 15:44

情况:

表: test_table

已有字段 (a,b,c)

已有分区:

day_key=20131201

day_key=20131202

day_key=20131203

 

需求是需要添加一个字段d

并且重新生成 所有分区的数据

 

步骤

1.添加字段:

alter table test_table add columns (d string);

2.执行语句

insert overwrite table test_table

select ....

 

此时问题产生了:

发现 新加的字段d 列 生成出来的数据

在已有的分区中

全是NULL

 

解决办法:

删除对应的分区 day_key=20131201

alter table test_table drop partition (day_key='20131201');

然后再次生成数据 发现d列的数据产生了。

0 0