HyukjinKwon commented on code in PR #37445:
URL: https://github.com/apache/spark/pull/37445#discussion_r941160451


##########
python/pyspark/context.py:
##########
@@ -1249,9 +1249,37 @@ def addFile(self, path: str, recursive: bool = False) -> 
None:
         ...        return [x * fileVal for x in iterator]
         >>> sc.parallelize([1, 2, 3, 4]).mapPartitions(func).collect()
         [100, 200, 300, 400]
+        >>> sc.listFiles
+        ['file:/.../test.txt']
+        >>> path2 = os.path.join(tempdir, "test2.txt")
+        >>> with open(path2, "w") as testFile:
+        ...    _ = testFile.write("100")
+        >>> sc.addFile(path2)
+        >>> sc.listFiles
+        ['file:/.../test.txt', 'file:/.../test2.txt']
         """
         self._jsc.sc().addFile(path, recursive)
 
+    @property
+    def listFiles(self) -> List[str]:
+        """Returns a list of file paths that are added to resources.
+
+        .. versionadded:: 3.4.0
+
+        See Also
+        --------
+        SparkContext.addFile
+        """
+        jfiles = self._jsc.sc().listFiles()
+        if jfiles is None:
+            return []
+        else:
+            files = []

Review Comment:
   Maybe:
   
   ```python
   
list(self._jvm.scala.collection.JavaConverters.seqAsJavaList(self._jsc.sc().listFiles()))
   ```
   
   Seems like it can't be `None` anyway.



-- 
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]

Reply via email to