HyukjinKwon commented on code in PR #41708: URL: https://github.com/apache/spark/pull/41708#discussion_r1239307028
########## python/pyspark/sql/session.py: ########## @@ -1767,6 +1772,92 @@ def __exit__( """ self.stop() + # SparkConnect-specific API + @property + def client(self) -> "SparkConnectClient": + """ + Gives access to the Spark Connect client. In normal cases this is not necessary to be used + and only relevant for testing. + + .. versionadded:: 3.4.0 + + Returns + ------- + :class:`SparkConnectClient` + + Notes + ----- + This is an API dedicated to Spark Connect client only. With regular Spark Session, it throws + an exception. + """ + raise RuntimeError( + "SparkSession.client is only supported with Spark Connect; " + "however, the current Spark session does not use Spark Connect." + ) + + def addArtifacts( + self, *path: str, pyfile: bool = False, archive: bool = False, file: bool = False + ) -> None: + """ + Add artifact(s) to the client session. Currently only local files are supported. + + .. versionadded:: 3.5.0 + + Parameters + ---------- + *path : tuple of str + Artifact's URIs to add. + pyfile : bool + Whether to add them as Python dependencies such as .py, .egg, .zip or .jar files. + The pyfiles are directly inserted into the path when executing Python functions + in executors. + archive : bool + Whether to add them as archives such as .zip, .jar, .tar.gz, .tgz, or .tar files. + The archives are unpacked on the executor side automatically. + file : bool + Add a file to be downloaded with this Spark job on every node. + The ``path`` passed can only be a local file for now. + + Notes + ----- + This is an API dedicated to Spark Connect client only. With regular Spark Session, it throws + an exception. + """ + raise RuntimeError( + "SparkSession.addArtifact(s) is only supported with Spark Connect; " + "however, the current Spark session does not use Spark Connect." + ) + + addArtifact = addArtifacts + + def copyFromLocalToFs(self, local_path: str, dest_path: str) -> None: + """ + Copy file from local to cloud storage file system. + If the file already exits in destination path, old file is overwritten. + + .. versionadded:: 3.5.0 Review Comment: Addressing my own comment: https://github.com/apache/spark/pull/41357#discussion_r1239306624 -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org