WeichenXu123 commented on code in PR #41357:
URL: https://github.com/apache/spark/pull/41357#discussion_r1211149046
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectAddArtifactsHandler.scala:
##########
@@ -89,6 +92,28 @@ class SparkConnectAddArtifactsHandler(val responseObserver:
StreamObserver[AddAr
artifactManager.addArtifact(holder, artifact.path, artifact.stagedPath,
artifact.fragment)
}
+ protected def uploadStagedArtifactToFS(artifact: StagedArtifact): Unit = {
+ try {
+ val hadoopConf = holder.session.sparkContext.hadoopConfiguration
+ assert(artifact.path.startsWith(forwardToFSPrefix))
+ val destFSPath = new FSPath(
+ Paths.get("/").resolve(artifact.path.subpath(1,
artifact.path.getNameCount)).toString
+ )
+ val localPath = artifact.stagedPath
+ val fs = destFSPath.getFileSystem(hadoopConf)
+ fs.copyFromLocalFile(
+ false,
+ true,
+ new FSPath(localPath.toString),
+ destFSPath
+ )
+ } catch {
+ case e: java.io.IOException =>
+ // TODO: report failure in response message
Review Comment:
@allisonwang-db
`handleError` is defined in `SparkConnectService` and it is private, but my
code is in `SparkConnectAddArtifactsHandler` class, how can I call
`handleError` from `SparkConnectAddArtifactsHandler` code ? Could you make
`handleError` to be a utility function that is accessible form other classes ?
--
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]