allisonwang-db commented on code in PR #41357:
URL: https://github.com/apache/spark/pull/41357#discussion_r1212021765


##########
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:
   @MaxGekk will be working on a new framework for error handling. 
@WeichenXu123 You can migrate to use the new framework when it's completed.



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