Closed
Description
I found it difficult to call DataStreamWriter.foreachBatch
because source code won't compile until explicit construction of VoidFunction2
is added.
So I suggest adding such an extension for DataStreamWriter
:
import org.apache.spark.api.java.function.VoidFunction2
import org.apache.spark.sql.Dataset
import org.apache.spark.sql.streaming.DataStreamWriter
public fun <T> DataStreamWriter<T>.forEachBatch(
func: (batch: Dataset<T>, batchId: Long) -> Unit
): DataStreamWriter<T> = foreachBatch(
VoidFunction2 { batch, batchId ->
func(batch, batchId)
}
)
Metadata
Metadata
Assignees
Labels
No labels