QuestionQ76

VerifiedProductionizing Data Pipelines

A data engineer is attempting to drop a Spark SQL table my_table and runs the following command:

DROP TABLE IF EXISTS my_table;

After running this command, the engineer notices that the data files and metadata files have been deleted from the file system.

What is the reason behind the deletion of all these files?

Explanation

When both data and metadata files are deleted, the table was managed rather than external. Managed tables store both data and metadata under the warehouse directory, so DROP TABLE removes everything. External tables delete only metadata, leaving data files intact.

Community Discussion

No comments yet. Be the first to start the discussion!