
Ultimate access to all questions.
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?
A
The table was managed
B
The table's data was smaller than 10 GB
C
The table did not have a location
D
The table was external
Explanation:
In Databricks/Spark SQL, there are two types of tables:
Managed Tables (also called internal tables):
DROP TABLE, both the metadata (table definition) AND the actual data files are deletedExternal Tables:
DROP TABLE, only the metadata (table definition) is deletedLOCATION clause when creating the tableIn this scenario, since both the data files AND metadata files were deleted after running DROP TABLE, this indicates that my_table was a managed table.
Key points:
Additional context:
CREATE TABLE my_table ... (without LOCATION clause)CREATE TABLE my_table ... LOCATION 'path/to/data'DESCRIBE EXTENDED my_table (look for 'Type' field)