How to delete/truncate tables from Hadoop-Hive?

前端 未结 4 2082
温柔的废话
温柔的废话 2020-12-29 05:30

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

相关标签:
4条回答
  • 2020-12-29 06:10

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

    0 讨论(0)
  • 2020-12-29 06:16

    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.

    0 讨论(0)
  • 2020-12-29 06:24

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

    hive -e 'show tables' | xargs -I '{}' hive -e 'drop table {}'
    
    0 讨论(0)
  • 2020-12-29 06:30

    To Truncate:

    hive -e "TRUNCATE TABLE IF EXISTS $tablename"
    

    To Drop:

    hive -e "Drop TABLE IF EXISTS $tablename"
    
    0 讨论(0)
提交回复
热议问题