QuestionQ107

VerifiedStructured Streaming

A data engineer must write a Streaming DataFrame as Parquet files.

df  
  .writeStream  
  // -- insert code here --  
  .checkpointLocation("path/to/checkpoint/dir")  
  .start()  

Which code fragment should be inserted to satisfy the requirement?

Explanation

Structured Streaming selects the output data source by passing its name directly to format, and parquet is a valid source name. For a file sink, the output directory is specified with the path option when start() is invoked without a path argument; therefore the required configuration is .format("parquet").option("path", "path/to/destination/dir").

Learn more

Community Discussion

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