Hive alter table drop column 失败 mismatched input 'column' expecting PARTITION near 'DROP' in drop pa

原文链接: http://www.it1352.com/842613.html

ALTER TABLE aaa DROP column (name);

失败:

 

语法校验失败!

line 1:49 mismatched input 'column' expecting PARTITION near 'DROP' in drop partition statement

原因及解决方法:

http://www.it1352.com/842613.html

 

You cannot drop column directly from a table using command ALTER TABLE table_name drop col_name;

The only way to drop column is using replace command. Lets say, I have a table emp with id, name and dept column. I want to drop id column of table emp. So provide all those columns which you want to be the part of table in replace columns clause. Below command will drop id column from emp table.

 ALTER TABLE emp REPLACE COLUMNS( name string, dept string);

 

你可能感兴趣的:(转载,原创)