【发布时间】:2016-04-25 09:55:11
【问题描述】:
我昨天刚开始学习 hive,我一直在更改 hive 中列的类型。我想问一下列类型的更改是否对它们有某种限制,因为我只能进行特定类型的更改,例如我可以将 int 转换为 double、string 为 double、double 为 string 但我不能将 string 更改为 int、double到int。
ALTER TABLE student CHANGE rollno rollno int;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. The following columns have types incompatible with the existing columns in their respective positions :
rollno
hive> DESCRIBE FORMATTED student
> ;
OK
# col_name data_type comment
rollno int
name string
phno string
city string
ALTER TABLE student CHANGE rollno rollno double;
OK
Time taken: 0.144 seconds
ALTER TABLE student CHANGE rollno rollno int;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. The following columns have types incompatible with the existing columns in their respective positions :
rollno
也不能使用字符串。所以请引导我找到答案,因为我似乎无法通过谷歌找到任何东西。
【问题讨论】: