参考博客:https://blog.csdn.net/yeweiouyang/article/details/44851459
参考博客:https://blog.csdn.net/helloxiaozhe/article/details/80749094
参考博客:https://www.cnblogs.com/congzhong/p/8494991.html
参考博客:https://blog.csdn.net/hanhaixingchen/article/details/53744132
参考博客:https://yq.aliyun.com/articles/66055
参考博客:https://blog.csdn.net/hjw199089/article/details/79056612
正确的方式:
alter table logs.service_log add columns (release_channel string) cascade ; alter table logs.service_log_lzo add columns (release_channel string) cascade ;此种方式会:
1、更新Table元数据;
2、更新Table所有分区的元数据;
3、service_log能正常解析出新增字段;
ALTER TABLE ADD|REPLACE COLUMNS with CASCADE command changes the columns of a table's metadata, and cascades the same change to all the partition metadata.
ADD COLUMNS lets you add new columns to the end of the existing columns but before the partition columns.
错误的方式:
alter table logs.service_log add columns (release_channel string); alter table logs.service_log_lzo add columns (release_channel string);注意:此种方式只会更新Table的元数据信息,不能解析出新增字段。
RESTRICT is the default, limiting column changes only to table metadata.
转载于:https://www.cnblogs.com/shujuxiong/p/9766639.html
