hive上删除列

来源:互联网 发布:社交网络种子 编辑:程序博客网 时间:2024/06/05 14:09

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


原创粉丝点击