@InterfaceStability.Evolving public interface ReadSupportWithSchema extends DataSourceV2
DataSourceV2
. Data sources can implement this interface to
provide data reading ability and scan the data from the data source.
This is a variant of ReadSupport
that accepts user-specified schema when reading data.
A data source can implement both ReadSupport
and ReadSupportWithSchema
if it
supports both schema inference and user-specified schema.Modifier and Type | Method and Description |
---|---|
DataSourceReader |
createReader(StructType schema,
DataSourceOptions options)
Create a
DataSourceReader to scan the data from this data source. |
DataSourceReader createReader(StructType schema, DataSourceOptions options)
DataSourceReader
to scan the data from this data source.
If this method fails (by throwing an exception), the action would fail and no Spark job was
submitted.schema
- the full schema of this data source reader. Full schema usually maps to the
physical schema of the underlying storage of this data source reader, e.g.
CSV files, JSON files, etc, while this reader may not read data with full
schema, as column pruning or other optimizations may happen.options
- the options for the returned data source reader, which is an immutable
case-insensitive string-to-string map.