How to delete/truncate tables from Hadoop-Hive?

2019-02-04 12:18发布

Please tell me how to delete table from hive and also tell from where i can get more information about hive queries.

标签: hadoop hive
4条回答
仙女界的扛把子
2楼-- · 2019-02-04 12:56

You can use drop command to delete meta data and actual data from HDFS.

And just to delete data and keep the table structure, use truncate command.

For further help regarding hive ql, check language manual of hive.

查看更多
Emotional °昔
3楼-- · 2019-02-04 13:00

Use the following to delete all the tables in a linux environment.

hive -e 'show tables' | xargs -I '{}' hive -e 'drop table {}'
查看更多
成全新的幸福
4楼-- · 2019-02-04 13:00

You need to drop the table and then recreate it and then load it again

查看更多
Bombasti
5楼-- · 2019-02-04 13:02

To Truncate:

hive -e "TRUNCATE TABLE IF EXISTS $tablename"

To Drop:

hive -e "Drop TABLE IF EXISTS $tablename"
查看更多
登录 后发表回答