QuestionQ131

Deployment Strategies

A machine learning engineer is using the following code block as part of a batch deployment pipeline:

Question Image

Which of the following change must be made for this code block to work when the inference table is a streaming source?

  • A Replace "inference" with the path to the location of the Delta table
  • B Replace schema(schema) with option("maxFilesPerTrigger", 1)
  • C Replace spark.read with spark.readStream
  • D Replace format("delta") with format("stream")
  • E Replace predict with a stream-friendly prediction function
Explanation

A streaming table must be loaded with SparkSession.readStream, which returns a DataStreamReader and supports defining a streaming DataFrame from a table whose data source supports streaming. spark.read is the batch reader, so it cannot create the required streaming source DataFrame. The Delta source format and table identifier remain valid.

Learn more

Community Discussion

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