/** * Creates a {@link DataSourceReader} to scan the data from this data source. * * If this method fails (by throwing an exception), the action will fail and no Spark job will be * submitted. * * @param schema the user specified schema. * @param options the options for the returned data source reader, which is an immutable * case-insensitive string-to-string map. * * By default this method throws {@link UnsupportedOperationException}, implementations should * override this method to handle user specified schema. */ default DataSourceReader createReader(StructType schema, DataSourceOptions options) { String name; if (this instanceof DataSourceRegister) { name = ((DataSourceRegister) this).shortName(); } else { name = this.getClass().getName(); } throw new UnsupportedOperationException(name + " does not support user specified schema"); }
/** * Creates a {@link DataSourceReader} to scan the data from this data source. * * If this method fails (by throwing an exception), the action will fail and no Spark job will be * submitted. * * @param schema the user specified schema. * @param options the options for the returned data source reader, which is an immutable * case-insensitive string-to-string map. * * By default this method throws {@link UnsupportedOperationException}, implementations should * override this method to handle user specified schema. */ default DataSourceReader createReader(StructType schema, DataSourceOptions options) { String name; if (this instanceof DataSourceRegister) { name = ((DataSourceRegister) this).shortName(); } else { name = this.getClass().getName(); } throw new UnsupportedOperationException(name + " does not support user specified schema"); }