Hive 修改表結構的方法有以下幾種:
ALTER TABLE table_name ADD COLUMN column_name INT;
ALTER TABLE table_name DROP COLUMN column_name;
ALTER TABLE table_name CHANGE COLUMN old_column_name new_column_name INT;
ALTER TABLE table_name SET TBLPROPERTIES('key'='value');
INSERT OVERWRITE TABLE table_name SELECT * FROM temp_table;
CREATE TABLE new_table_name AS SELECT column1, column2 FROM table_name;
HiveMetaStoreClient client = new HiveMetaStoreClient(new HiveConf());
Table table = client.getTable("database_name", "table_name");
table.getSd().getCols().add(new FieldSchema("new_column_name", "int", "new column"));
client.alter_table("database_name", "table_name", table);
以上是幾種常見的Hive修改表結構的方法,具體操作可以根據需求選擇合適的方法。