outputMode method in spark
The outputMode method specifies how the output of the streaming query should be written to the sink. There are three possible output modes:
“append“: This mode writes the output of the streaming query to the sink as new data becomes available. This is the default output mode.
“complete“: This mode writes the output of the streaming query to the sink as a complete dataset, replacing any existing data in the sink.
“update“: This mode writes the output of the streaming query to the sink as updates to the existing data in the sink. This is useful when the output of the streaming query contains updates to the previous output, rather than a complete dataset.
The outputMode(“update”) method can be used in Apache Spark Structured Streaming when writing the output of a streaming query to a sink (such as a file or a database).
To use the outputMode(“update”) method, the output of the streaming query must contain only update records, rather than a complete dataset.