You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2023/04/20 18:29:07 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #40827: [WIP][SPARK-42585][CONNECT] Streaming of local relations

MaxGekk commented on code in PR #40827:
URL: https://github.com/apache/spark/pull/40827#discussion_r1172952125


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/artifact/SparkConnectArtifactManager.scala:
##########
@@ -91,7 +93,18 @@ class SparkConnectArtifactManager private[connect] {
       remoteRelativePath: Path,
       serverLocalStagingPath: Path): Unit = {
     require(!remoteRelativePath.isAbsolute)
-    if (remoteRelativePath.startsWith("classes/")) {
+    if (remoteRelativePath.startsWith("cache/")) {
+      val tmpFile = serverLocalStagingPath.toFile
+      Utils.tryWithSafeFinallyAndFailureCallbacks {
+        val updater = session.sparkContext.env.blockManager.TempFileBasedBlockStoreUpdater(
+          blockId = CacheId(remoteRelativePath.toString.stripPrefix("cache/")),
+          level = StorageLevel.MEMORY_AND_DISK,
+          classTag = implicitly[ClassTag[Object]],
+          tmpFile = tmpFile,
+          blockSize = tmpFile.length())
+        updater.save()
+      }(catchBlock = {tmpFile.delete()})

Review Comment:
   Yep, makes sense. Let me try that.



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org