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 就可以了。

相关推荐
error:(1 小时前
【超详细】讯飞智能车PC电脑烧录指南(高级系统部署与恢复)
数据仓库·电脑
RestCloud1 小时前
ETL常见的数据转换方式
数据仓库·mysql·etl·数据处理·数据集成工具·集成平台
Edingbrugh.南空1 天前
Hive 3.x数据静态脱敏与加密
数据仓库·hive·hadoop
春马与夏1 天前
多参表达式Hive UDF
数据仓库·hive·hadoop
ThisIsClark1 天前
什么是Hive
数据仓库·hive·hadoop
Edingbrugh.南空1 天前
Hive 3.x集成Apache Ranger:打造精细化数据权限管理体系
hive·hadoop·apache
Edingbrugh.南空2 天前
Iceberg与Hive集成深度
数据仓库·hive·hadoop
云淡风轻~~2 天前
Hadoop HDFS存储机制与块大小选择权衡
hadoop·hdfs
Edingbrugh.南空2 天前
Apache Iceberg与Hive集成:分区表篇
大数据·hive·hadoop
Cachel wood2 天前
后端开发:计算机网络、数据库常识
android·大数据·数据库·数据仓库·sql·计算机网络·mysql