Delete Data from Hive External Table
There are two methods available in Hive to delete data from an external table.
- Use HiveQL statements:
TRUNCATE TABLE table_name;
This statement will delete all data from the external table, but will preserve the structure and metadata of the table.
- You can use HDFS commands directly to delete the data files corresponding to the external table, for example:
hdfs dfs -rm -r /path/to/data/file
This will delete the data files corresponding to the external table in HDFS, but it will not affect the metadata of the external table.