
Answer-first summary for fast verification
Answer: The table reference in the metastore is updated, but no data movement or changes to the underlying files occur.
The `ALTER TABLE ... RENAME TO` command is a **metadata-only operation**. 1. **Metastore Update**: It simply changes the entry in the Hive Metastore or Unity Catalog to map the new table name to the existing storage location. 2. **No Data Movement**: The underlying Delta format data directory, its transaction log (`_delta_log`), and all Parquet data files remain in their original location (`/mnt/production/saledata_by_store`) and are completely untouched. 3. **No Transaction Log Entry**: Because the Delta transaction log tracks changes to the data and schema *inside* the directory, a metadata rename in the catalog does not trigger a new commit in the Delta log itself. 4. **Efficiency**: This is a nearly instantaneous operation because it does not involve costly I/O or file relocation.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A Delta Lake table named production.saledata_by_user was initially created with the following query:
CREATE TABLE production.saledata_by_user
USING DELTA
LOCATION "/mnt/production/saledata_by_store"
CREATE TABLE production.saledata_by_user
USING DELTA
LOCATION "/mnt/production/saledata_by_store"
Recognizing a typographical error in the table name, the developer executed the following command:
ALTER TABLE production.saledata_by_user RENAME TO production.saledata_by_store
ALTER TABLE production.saledata_by_user RENAME TO production.saledata_by_store
What is the outcome of running this second command?
A
The table reference in the metastore is updated, and all underlying data files are relocated to a new path matching the table name.
B
The table reference in the metastore is updated, but no data movement or changes to the underlying files occur.
C
The rename operation is recorded as a new version in the Delta transaction log.
D
A new Delta transaction log is initiated in the storage path for the renamed table.
E
The existing data and metadata are discarded and then regenerated within a single ACID transaction.