gaogaotiantian commented on code in PR #53898:
URL: https://github.com/apache/spark/pull/53898#discussion_r2714709660
##########
python/pyspark/sql/streaming/readwriter.py:
##########
@@ -241,6 +242,52 @@ def options(self, **options: "OptionalPrimitiveType") ->
"DataStreamReader":
self._jreader = self._jreader.option(k, to_str(options[k]))
return self
+ def name(self, source_name: str) -> "DataStreamReader":
+ """Specifies a name for the streaming source.
+
+ This name is used to identify the source in checkpoint metadata and
enables
+ stable checkpoint locations for source evolution.
+
+ .. versionadded:: 4.2.0
+
+ Parameters
+ ----------
+ source_name : str
+ the name to assign to this streaming source. Must contain only
ASCII letters,
+ digits, and underscores.
+
+ Returns
+ -------
+ :class:`DataStreamReader`
+
+ Notes
+ -----
+ This API is experimental.
+
+ Examples
+ --------
+ >>> spark.readStream.format("rate").name("my_source") # doctest: +SKIP
+ <...streaming.readwriter.DataStreamReader object ...>
+ """
+ if not source_name or not isinstance(source_name, str):
Review Comment:
If an empty `source_name` is provided, the code will raise an error with
`errorClass="NOT_STR"` saying argument type is `str` - is that a bit confusing?
--
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]