Called when stopping to process one partition of new data in the executor side.
Called when stopping to process one partition of new data in the executor side. This is
guaranteed to be called either open
returns true
or false
. However,
close
won't be called in the following cases:
Throwable
open
throws a Throwable
.the error thrown during processing data or null if there was no error.
Called when starting to process one partition of new data in the executor.
Called when starting to process one partition of new data in the executor. See the class
docs for more information on how to use the partitionId
and epochId
.
the partition id.
a unique id for data deduplication.
true
if the corresponding partition and version id should be processed. false
indicates the partition should be skipped.
Called to process the data in the executor side.
Called to process the data in the executor side. This method will be called only if open
returns true
.
The abstract class for writing custom logic to process data generated by a query. This is often used to write the output of a streaming query to arbitrary storage systems. Any implementation of this base class will be used by Spark in the following way.
open(...)
method has been called, which signifies that the task is ready to generate data.Important points to note:
foreachBatch
instead.close()
method will be called ifopen()
method returns successfully (irrespective of the return value), except if the JVM crashes in the middle.Scala example:
Java example:
2.0.0