Optional<DataSourceWriter> createWriter(
String writeUUID,
StructType schema,
SaveMode mode,
DataSourceOptions options)
WriteSupport Contract — "Writable" Data Sources
WriteSupport is the abstraction of "writable" data sources in the Data Source API V2 that can create a DataSourceWriter for writing data out.
WriteSupport defines a single createWriter method that creates an optional DataSourceWriter per SaveMode (and can create no DataSourceWriter when not needed per mode)
createWriter is used when:
-
DataFrameWriteris requested to save a DataFrame to a data source (for DataSourceV2 data sources with WriteSupport) -
DataSourceV2Relationleaf logical operator is requested to create a DataSourceWriter (indirectly via createWriter implicit method)
// FIXME: Demo
// df.write.format(...) that is DataSourceV2 and WriteSupport
|
Note
|
There are no production implementations of the WriteSupport Contract in Spark SQL yet. |