HyukjinKwon commented on code in PR #43360:
URL: https://github.com/apache/spark/pull/43360#discussion_r1361857907
##########
python/pyspark/sql/readwriter.py:
##########
@@ -303,6 +330,40 @@ def load(
if schema is not None:
self.schema(schema)
self.options(**options)
+
+ # Load a Python data source
+ if isinstance(self._format, Callable): # type: ignore[arg-type]
+ # TODO(SPARK-45560): support load() with non-empty path.
+
+ # Create an instance of the data source.
+ data_source_cls = cast(Type[DataSource], self._format)
+ data_source = data_source_cls(self._options)
+
+ # Get schema of the data source
+ schema = self._schema or data_source.schema()
Review Comment:
This is a bit hacky. For example, if we run this in Spark Connect, the
schema inference would happen within Python Spark Connect client.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]