Hive drop column 的解决方法

示例:

创建 text 格式的表

sql 复制代码
create table t1(c1 int, c2 int) stored as textfile;

增加一个字段

sql 复制代码
alter table t1 add columns (c3 int);

使用 replace columns 删除新加的字段

sql 复制代码
alter table t1 replace columns (c1 int, c2 int);

对于 ORC 类型的表,使用 replace columns 可能抛出以下异常"

sql 复制代码
org.apache.hadoop.hive.ql.metadata.HiveException: Replacing columns cannot drop columns for table xxx. SerDe may be incompatible

解决方法:

sql 复制代码
set hive.exec.schema.evolution=false;

然后再执行 replace columns 就可以了。

相关推荐
爱吃面的猫8 小时前
大数据Hadoop之——Flink1.17.0安装与使用(非常详细)
大数据·hadoop·分布式
zhuiQiuMX9 小时前
脉脉maimai面试死亡日记
数据仓库·sql·面试
Edingbrugh.南空18 小时前
Hadoop MapReduce 入门
大数据·hadoop·mapreduce
大数据CLUB2 天前
基于spark的奥运会奖牌变化数据分析
大数据·hadoop·数据分析·spark
Edingbrugh.南空2 天前
Hadoop高可用集群搭建
大数据·hadoop·分布式
无级程序员3 天前
hive2服务启动报错:/tmp/hive on HDFS should be writable(不是chmod 777能解决的)
hive·hadoop·hdfs
rui锐rui3 天前
大数据学习2:HIve
大数据·hive·学习
凌辰揽月3 天前
Servlet学习
hive·学习·servlet
weixin_307779133 天前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习
王小王-1233 天前
基于Hadoop的公共自行车数据分布式存储和计算平台的设计与实现
大数据·hive·hadoop·分布式·hadoop公共自行车·共享单车大数据分析·hadoop共享单车