Comprehensive and Detailed Explanation From Exact Extract:
To write a structured streaming DataFrame to Parquet files, the correct way to specify the format and output directory is:
writeStream
format("parquet")
option("path", "path/to/destination/dir")
According to Spark documentation:
“When writing to file-based sinks (like Parquet), you must specify the path using the .option("path", ...) method. Unlike batch writes, .save() is not supported.”
Option A incorrectly uses.option("location", ...)(invalid for Parquet sink).
Option B incorrectly sets the format via.option("format", ...), which is not the correct method.
Option C repeats the same issue.
Option D is correct:.format("parquet")+.option("path", ...)is the required syntax.
Final Answer: D
Submit