hive上删除列
hive上删除列 很简单 replace 就好,但是只是在元数据中删除了而已,其实并没有改动hdfs上的数据文件hive> select * from product;OKid name1 apple2 samsung3 moto1 apple执行删除列:hive> alter table p
   ·  
 hive上删除列 很简单 replace 就好,但是只是在元数据中删除了而已,其实并没有改动hdfs上的数据文件
hive> select * from product;
  OK
  id      name
  1       apple
  2       samsung
  3       moto
  1       apple
  执行删除列:
hive> alter table product replace columns(name string);
  OK
  Time taken: 0.215 seconds
  hive> select * from product;
  OK
  name
  1
  2
  3
  1
  2
  发现其实这并不是我们想要的,后面的列值往前移动了
而数据文件也没有什么变化
hive> dfs  -cat  /user/hive/warehouse/psi.db/product/000000_0;
  1       apple
  2       samsung
  3       moto
  1       apple
  2       samsung
更多推荐
 
 



所有评论(0)