欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > Hive drop column 的解决方法

Hive drop column 的解决方法

2025/5/21 22:49:54 来源:https://blog.csdn.net/houzhizhen/article/details/148090033  浏览:    关键词:Hive drop column 的解决方法

示例:
创建 text 格式的表

create table t1(c1 int, c2 int) stored as textfile;

增加一个字段

alter table t1 add columns (c3 int);

使用 replace columns 删除新加的字段

alter table t1 replace columns (c1 int, c2 int);

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

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

解决方法:

set hive.exec.schema.evolution=false;

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

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词