RamonZhou commented on code in PR #60474:
URL: https://github.com/apache/spark/pull/60474#discussion_r4607223176
##########
python/pyspark/sql/session.py:
##########
@@ -2345,6 +2345,76 @@ def addArtifacts(
addArtifact = addArtifacts
+ def listFiles(self) -> List[str]:
+ """
+ Returns the paths of the files added to resources, as
:attr:`SparkContext.listFiles`.
+
+ These are the files added with :meth:`SparkSession.addArtifacts` with
``file`` or
+ ``pyfile`` set, or with the ``ADD FILE`` SQL statement, and those
added to the
+ :class:`SparkContext`, such as with ``--files``. Without Spark
Connect, these are all the
+ files added to the :class:`SparkContext`, also by other sessions. With
Spark Connect, these
+ are the files added to this session and those added to the server
outside of any session,
+ but not those of the other sessions, which servers before Spark 4.4
also list. A file
+ uploaded with :meth:`SparkSession.addArtifacts` is listed as the URI
of its copy on the
+ server, and one added with ``ADD FILE`` as
:attr:`SparkContext.listFiles` lists it, such as
+ by the path it was added with when the server runs in local mode.
+
+ .. versionadded:: 4.4.0
+
+ Returns
+ -------
+ list of str
+ The paths of the files, in no particular order.
+
+ See Also
+ --------
+ :meth:`SparkSession.addArtifacts`
+ :meth:`SparkSession.listArchives`
+
+ Examples
+ --------
+ >>> spark.addArtifacts("/tmp/my_file.txt", file=True) # doctest: +SKIP
+ >>> spark.listFiles() # doctest: +SKIP
+ ['file:/tmp/my_file.txt']
Review Comment:
Fixed
--
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]