QuestionQ278

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

A Spark application must read multiple Parquet files in a directory whose schemas differ but are compatible. The data engineer needs to create a DataFrame that contains every column from all files.

Which Apache Spark code should the data engineer use to read the Parquet files and include all columns?

Explanation

Spark’s Parquet reader supports schema evolution by merging compatible schemas from all input files when the mergeSchema read option is set to true. The resulting DataFrame contains the union of the files’ columns; schema merging is disabled by default.

Learn more

Community Discussion

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