
Answer-first summary for fast verification
Answer: The table reference in the metastore is updated, but the underlying data files remain in their original location.
When you execute `ALTER TABLE ... RENAME TO` on a Delta Lake table, it is a metadata-only operation. The pointer in the metastore (Hive Metastore or Unity Catalog) is updated to the new table name, but the underlying data files stay exactly where they were originally stored. * **Data Movement:** Renaming a table does not trigger a physical move of data files on the cloud storage. * **Transaction Log:** While the rename is an event captured in the log, it does not create a new, independent transaction log directory. * **ACID Properties:** The operation is atomic and lightweight, not a destructive drop-and-recreate process.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
A data engineer creates a Delta Lake table with the following SQL command:
CREATE TABLE dev.my_table
USING DELTA
LOCATION "/mnt/dev/my_table";
CREATE TABLE dev.my_table
USING DELTA
LOCATION "/mnt/dev/my_table";
Later, the engineer decides to rename the table for shared use by executing:
ALTER TABLE dev.my_table RENAME TO dev.our_table;
ALTER TABLE dev.my_table RENAME TO dev.our_table;
What is the result of running this ALTER TABLE command?
A
The table reference in the metastore is updated, and all underlying data files are physically moved to a new directory.
B
A new Delta transaction log is initialized for the renamed table, separate from the original.
C
The table reference in the metastore is updated, but the underlying data files remain in their original location.
D
The table name change is recorded exclusively in the Delta transaction log, and the metastore remains unchanged.
E
All related files and metadata are dropped and recreated in a single ACID transaction to reflect the new name.
No comments yet.