@InterfaceStability.Evolving public interface WriteSupport extends DataSourceV2
DataSourceV2
. Data sources can implement this interface to
provide data writing ability and save the data to the data source.Modifier and Type | Method and Description |
---|---|
java.util.Optional<DataSourceWriter> |
createWriter(String jobId,
StructType schema,
SaveMode mode,
DataSourceOptions options)
Creates an optional
DataSourceWriter to save the data to this data source. |
java.util.Optional<DataSourceWriter> createWriter(String jobId, StructType schema, SaveMode mode, DataSourceOptions options)
DataSourceWriter
to save the data to this data source. Data
sources can return None if there is no writing needed to be done according to the save mode.
If this method fails (by throwing an exception), the action would fail and no Spark job was
submitted.jobId
- A unique string for the writing job. It's possible that there are many writing
jobs running at the same time, and the returned DataSourceWriter
can
use this job id to distinguish itself from other jobs.schema
- the schema of the data to be written.mode
- the save mode which determines what to do when the data are already in this data
source, please refer to SaveMode
for more details.options
- the options for the returned data source writer, which is an immutable
case-insensitive string-to-string map.