我想更改Hive表中某些列的类型。
首先,这是我的蜂巢表的描述:
hive (indicateurs)> describe adataindicateursf;
OK
nom string from deserializer
mod string from deserializer
val1 string from deserializer
val2 string from deserializer
val3 string from deserializer
datar string from deserializer
cdb string from deserializer
met string from deserializer
env string from deserializer
ncre string from deserializer
app string from deserializer
type string from deserializer
然后将val2的类型更改为整数,并将val2的类型更改为双精度。
ALTER TABLE adataindicateursf CHANGE val2 val2 int AFTER val1;
ALTER TABLE adataindicateursf CHANGE val3 val3 double AFTER val2;
但是,没有任何变化:
describe adataindicateursf;
OK
nom string from deserializer
mod string from deserializer
val1 string from deserializer
val2 string from deserializer
val3 string from deserializer
datar string from deserializer
cdb string from deserializer
met string from deserializer
env string from deserializer
ncre string from deserializer
app string from deserializer
type string from deserializer
这是什么问题?
答案 0 :(得分:0)
Try this:
ALTER TABLE adataindicateursf CHANGE val2 val2 int;
ALTER TABLE adataindicateursf CHANGE val3 val3 double;
if the above query are not working then try this:
set hive.metastore.disallow.incompatible.col.type.changes=false
when you set the properties then the types of columns in Metastore can be changed from any type to any other type.