我们如何更改 Hive 中多列的数据类型?
CREATE TABLE test_change (a int, b int, c int);
ALTER TABLE test_change CHANGE a a string b b doube c c decimal(11,2);
最佳答案
据我所知,你不能。在 Hive 文档中,您可以找到以下内容:
ALTER TABLE table_name [PARTITION partition_spec] CHANGE [COLUMN] col_old_name col_new_name column_type [COMMENT col_comment] [FIRST|AFTER column_name] [CASCADE|RESTRICT];
This command will allow users to change a column's name, data type, comment, or position, or an arbitrary combination of them. The PARTITION clause is available in Hive 0.14.0 and later; see Upgrading Pre-Hive 0.13.0 Decimal Columns for usage. A patch for Hive 0.13 is also available (see HIVE-7971).
文档是在谈论“一列”。 另一种方法是编写多个查询,一个用于您必须更改的每种数据类型。
引用:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
关于hadoop - 改变配置单元多列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41613590/