forEachBatch

fun <T> <Error class: unknown class><T>.forEachBatch(func: (<Error class: unknown class><T>, batchId: Long) -> Unit): <Error class: unknown class><T>

:: Experimental ::

(Scala-specific) Sets the output of the streaming query to be processed using the provided function. This is supported only in the micro-batch execution modes (that is, when the trigger is not continuous). In every micro-batch, the provided function will be called in every micro-batch with (i) the output rows as a Dataset and (ii) the batch identifier. The batchId can be used to deduplicate and transactionally write the output (that is, the provided Dataset) to external systems. The output Dataset is guaranteed to be exactly the same for the same batchId (assuming all operations are deterministic in the query).

Since

2.4.0