问题描述
我正在使用Hive 0.9版,并且需要删除Hive表中的列.我在hive命令的几本手册中进行了搜索,但只有我发现了0.14版的命令.是否可以在hive版本0.9中删除hive表的列?命令是什么?谢谢.
I am working with hive version 0.9 and I need delete columns of a hive table. I have searched in several manuals of hive commands but I only I have found commands to version 0.14. Is possible to delete a column of a hive table in hive version 0.9? What is the command?Thanks.
推荐答案
我们不能简单地使用下面的语句(如sql)从配置单元表中删除表列.
We can’t simply drop a table column from a hive table using the below statement like sql.
ALTER TABLE tbl_name删除列column_name ----将不起作用.
ALTER TABLE tbl_name drop column column_name ---- it will not work.
因此,有一种从配置单元表中删除列的快捷方式.
So there is a shortcut to drop columns from a hive table.
假设我们有一个蜂巢表.
Let’s say we have a hive table.
我要从该表中删除Dob列.您可以使用ALTER TABLE REPLACE语句删除列.
From this table I want to drop the column Dob. You can use the ALTER TABLE REPLACE statement to drop a column.
ALTER TABLE test_tbl REPLACE COLUMNS(ID STRING,NAME STRING,AGE STRING); you have to give the column names which you want to keep in the table
这篇关于删除配置单元表中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!