QuestionQ181

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

A data engineer must persist a file-based data source at a specific location. However, after review, the data is consistently stored in the warehouse directory by default.

Which line of code should the data engineer use to ensure that the data is saved to a specific location rather than the default warehouse directory?

Explanation

For a file-based data source, setting the writer option path before calling saveAsTable specifies a custom table location. Without a custom table path, Spark writes the table beneath the warehouse directory. option() returns the configured DataFrameWriter, allowing saveAsTable() to use that location.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!