这与Apache Hive分区问题有关。表创建后的Hive分区和新属性介绍
创建分区表后请帮助我添加新的属性添加。 新的属性数据未加载。
有什么我们需要调整的?
数据:
header: id, name, date, sal
dummy.txt
---------
1,Narayana,20150201,20.345
2,Narayana1,20150202,23.654
3,Narayana2,20150203,776.23
4,Narayana3,20150204,23.224
5,Narayana4,20150205,77.88
6,Narayana5,20150206,99.765
DDL
create schema nari;
use nari;
drop table x_1;
create external table x_1(
id int
,name string
,dt string
,sal double)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
LOCATION '/user/hdpcsc/data';
drop table p_emp;
create table p_emp(
id int
,name string
,dt string)
partitioned by(fp string)
CLUSTERED BY (id) SORTED BY (id asc) INTO 256 BUCKETS
STORED AS ORC TBLPROPERTIES("orc.compress"="SNAPPY");
insert1
insert overwrite table p_emp partition(fp="Q1FY15")
select id, name, dt from x_1;
选择
select * from p_emp; -- works well
insert2
insert overwrite table p_emp partition(fp="FCQ116")
select id, name, dt from x_1;
选择
select * from p_emp; -- works well
现在增加新的属性
alter table p_emp add columns (sal double);
insert4
insert overwrite table p_emp partition(fp="Q1FY15")
select id, name, dt, sal from x_1;
选择
select * from p_emp; -- sal attr null data
insert5
insert overwrite table p_emp partition(fp="FCQ116")
select id, name, dt, sal from x_1;
选择
select * from p_emp; -- sal attr null data
当您从普通表格x_1中选择时,您是否获得薪水值? – madhu
是的,我从x_1获得值'hive(nari)> select *; 确定 x_1.id x_1.name x_1.dt x_1.sal 1 Narayana 20150201 20。取345 2 Narayana1 20150202 23.654 3 Narayana2 20150203 776.23 4 Narayana3 20150204 23.224 5 Narayana4 20150205 77.88 6 Narayana5 20150206 99.765 时间:0.068秒,抓取时间:6行(多个)' –