CREATE EXTERNAL TABLE XXX(
id string,
score double
)partitioned by(dtm string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'
STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
LOCATION 's3://.../XXX';
修改字段名
alter table XXX change score scores double cascade;
注意:如果不加cascade参数,修改表结构后重新写入数据会造成以前的该字段值为null
alter table XXX replace columns (id string) cascade;
alter table XXX add columns (grade int) cascade;
写入数据
insert overwrite table XXX PARTITION (dtm='{{ds_nodash}}')
select a,b from YYY
where dtm='{{ds_nodash}}')