The method saveAsTable() creates a new table and optionally fails if the table exists.
From Spark documentation:
"The mode 'ErrorIfExists' (default) will throw an error if the table already exists."
Thus:
Option A is correct.
Option B (Overwrite) would overwrite existing data — not acceptable here.
Option C and D use save(), which doesn't create a managed table with metadata in the metastore.
Final Answer: A
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit