Hive partition table to increase the field

Hive partition table adds columns. The

Insert picture description here


Insert picture description here


Insert picture description here


Insert picture description here


newly added column will

Insert picture description here


Insert picture description here


display null after inserting data, but the data can still be found in presto. It should be related to the hive table structure. After modifying the Hive partition table structure, it will be in the metadata database. The CD_ID corresponding to the table in the SDS will change, but the corresponding CD_ID under the table partition is still the CD_ID of the original table. The SDS table mainly saves the basic information of the file storage, such as INPUT_FORMAT, OUTPUT_FORMAT, whether it is compressed, etc.
Therefore, you need to use mysql to modify the metadata. For details, see the link description here.

Insert picture description here


Insert picture description here


If you put it in the partition of the next day, you can find out the data

Insert picture description here
drop table if exists test;

create  table test(
`name` string COMMENT '姓名',
`age` string COMMENT '年龄'
) COMMENT '1'
PARTITIONED BY (dt string)
stored as parquet
LOCATION '/warehouse/yizun/dwd/test'
TBLPROPERTIES('parquet.compression'='lzo');

insert  into table  test partition(dt='2021-06-04') values('zs','15');

alter table test add columns(fs string comment '分数');

insert  into table  test partition(dt='2021-06-04') values('ls','18','99');

insert  into  table test partition(dt='2021-06-05') values('ww','10','66');