DATABRICKS-CERTIFIED-DATA-ENGINEER-ASSOCIATE · Question #4
A data engineer is attempting to drop a Spark SQL table my_table. The data engineer wants to delete all table metadata and data. They run the following command: DROP TABLE IF EXISTS my_table While…
The correct answer is C. The table was external. In Spark SQL, there are two types of tables: managed and external. When you DROP a managed table, both metadata and underlying data files are deleted. When you DROP an external table, only the metadata is removed from the metastore - the actual data files at the external…
Question
Options
- AThe table's data was larger than 10 GB
- BThe table's data was smaller than 10 GB
- CThe table was external
- DThe table did not have a location
- EThe table was managed
How the community answered
(35 responses)- B3% (1)
- C94% (33)
- D3% (1)
Explanation
In Spark SQL, there are two types of tables: managed and external. When you DROP a managed table, both metadata and underlying data files are deleted. When you DROP an external table, only the metadata is removed from the metastore - the actual data files at the external location are left intact. Since the metadata was deleted (table no longer appears in SHOW TABLES) but the data files still exist, this is the behavior of an external table. The data size (options A/B) is irrelevant to DROP behavior, and 'no location' would imply a managed table.
Topics
Community Discussion
No community discussion yet for this question.