這與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行(多個)' –