Delete column in hive table

I am working with hive version 0.9 and I need to remove the hive table columns. I searched in several beehive team manuals, but I only found commands for version 0.14. Can a hive table column be deleted in hive version 0.9? Which team? Thank.

+4
source share
7 answers

We cannot just remove the table column from the hive table using the following statement, for example sql.

ALTER TABLE tbl_name drop column column_name ---- it will not work.

So, there is a shortcut to remove columns from the hive table.

Let's say we have a beehive table.

From this table I want to remove the Dob column. You can use the ALTER TABLE REPLACE statement to delete 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
+16
source

Hive does not have a drop or delete column.

SELECT regex Hive 0.13.0 0.13.0 , hive.support.quoted.identifiers none.

, :

drop table if       exists database.table_name;
create table if not exists database.table_name as
select `(column_to_remove_1|...|column_to_remove_N)?+.+`
    from database.some_table
    where 
    ...
;

some_table, column_to_remove_1,..., to column_to_remove_N. .

+3
ALTER TABLE table_name REPLACE COLUMNS ( c1 int, c2 String);

: . .

+1

hive. ( ) ( ), . , ( ), :

show create table database_name.table_name;

( ). ,

0

empid, , , , . . REPLACE COLUMNS, jdbc: hive2://" > alter table employee (empid int, , dept, int);

0

, , alter.

Alter - replace .

: fooobar.com/questions/2254603/...

0

Thanks for the information ALTER TABLE test_tbl REPLACE COLUMNS (ID STRING, NAME STRING, AGE STRING); this command works for me

0
source

All Articles