You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "lifulong (via GitHub)" <gi...@apache.org> on 2024/07/10 12:08:40 UTC

[PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

lifulong opened a new pull request, #47281:
URL: https://github.com/apache/spark/pull/47281

   ### What changes were proposed in this pull request?
   Use isolated JobArtifactSet for each spark session
   
   
   ### Why are the changes needed?
   Consider multi user use same spark cluster with independent spark session, for example Kyuubi group session share level
   
   User may use different udf jar to register function, but may has same name udf in different udf jar.
   In this case, the valid udf class is always the class from the first load udf jar, this not meet users expections, user want use the udf class for the jar load by themself
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   New unit test in SessionJobArtifactStateSuite
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673664698


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     
+  private[sql] def cloneJobArtifactSet(parentSessionId: String,
+                                       childSessionId: String): Unit = {
+      sparkContext.addedJars.get(parentSessionId).map{ jars =>

Review Comment:
   ```suggestion
       sparkContext.addedJars.get(parentSessionId).foreach { jars =>
   ```



##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     
+  private[sql] def cloneJobArtifactSet(parentSessionId: String,
+                                       childSessionId: String): Unit = {
+      sparkContext.addedJars.get(parentSessionId).map{ jars =>
+      val newJars = new ConcurrentHashMap[String, Long]().asScala ++= jars
+      sparkContext.addedJars.put(childSessionId, newJars)
+    }
+    sparkContext.addedFiles.get(parentSessionId).map{ files =>

Review Comment:
   ```suggestion
       sparkContext.addedFiles.get(parentSessionId).foreach { files =>
   ```



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673664253


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     
+  private[sql] def cloneJobArtifactSet(parentSessionId: String,
+                                       childSessionId: String): Unit = {

Review Comment:
   ```suggestion
     private[sql] def cloneJobArtifactSet(parentSessionId: String, childSessionId: String): Unit = {
   ```



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1675167664


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  var jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   I think the session state should be immutable. Can we refactor whole things to here? Basically we need to move things `JobArtifactSet` to here. Should probably leverage `InheritableThreadLocal`.
   
   Now `JobArtifactSet` works as a threadlocal. If we want the proper inheritance between sessions, should probably use `InheritableThreadLocal`. 
   
   I think we really need a design here.



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673664966


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     
+  private[sql] def cloneJobArtifactSet(parentSessionId: String,
+                                       childSessionId: String): Unit = {
+      sparkContext.addedJars.get(parentSessionId).map{ jars =>
+      val newJars = new ConcurrentHashMap[String, Long]().asScala ++= jars
+      sparkContext.addedJars.put(childSessionId, newJars)
+    }
+    sparkContext.addedFiles.get(parentSessionId).map{ files =>
+      val newFiles = new ConcurrentHashMap[String, Long]().asScala ++= files
+      sparkContext.addedFiles.put(childSessionId, newFiles)
+    }
+    sparkContext.addedArchives.get(parentSessionId).map{ archives =>

Review Comment:
   ```suggestion
       sparkContext.addedArchives.get(parentSessionId).foreach { archives =>
   ```



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on PR #47281:
URL: https://github.com/apache/spark/pull/47281#issuecomment-2222487866

   > If we want this to be done properly, I think we should refactor the whole thing. The thread local in `JobArtifactSet` has to live in SparkSession instead for example.
   
   `JobArtifactSet` is not thread local, i think you means `JobArtifactState`, it is thread local, `JobArtifactState` has been in SparkSession in this change pr
   i add a jobArtifactState variable in spark session , which type is  `JobArtifactState`
   is this meet your expection?


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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #47281:
URL: https://github.com/apache/spark/pull/47281#issuecomment-2222407612

   If we want this to be done properly, I think we should refactor the whole thing. The thread local in `JobArtifactSet` has to live in SparkSession instead for example.


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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673351143


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +113,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  private[sql] val jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   Just curious. `JobArtifactState` is currently only used in Spark Connect. How do you use this with Kyuubi?



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673664848


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     

Review Comment:
   ok



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1675398483


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  var jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   should consider direct call of SparkContext.addJar, it exists in many unit tests



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #47281:
URL: https://github.com/apache/spark/pull/47281#issuecomment-2451066235

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673671369


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     
+  private[sql] def cloneJobArtifactSet(parentSessionId: String,
+                                       childSessionId: String): Unit = {
+      sparkContext.addedJars.get(parentSessionId).map{ jars =>
+      val newJars = new ConcurrentHashMap[String, Long]().asScala ++= jars
+      sparkContext.addedJars.put(childSessionId, newJars)
+    }
+    sparkContext.addedFiles.get(parentSessionId).map{ files =>
+      val newFiles = new ConcurrentHashMap[String, Long]().asScala ++= files
+      sparkContext.addedFiles.put(childSessionId, newFiles)
+    }
+    sparkContext.addedArchives.get(parentSessionId).map{ archives =>

Review Comment:
   ok, i will optimize the code by your advice



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673547207


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +113,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  private[sql] val jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   "In kyuubi group share level, multi user may load their own udf jar, and may exist same udf class name in different jar, lead the first load class take effect always"
   each user create their own spark session in same spark engine(spark cluster), each spark session use isolated aritifact set



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1675368889


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  var jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   it sounds good support proper inheritance between sessions, but i no full idea of implement this target, i will mark this pr as draft
   can you implement it, when complete, we will patch spark official implement to our inner spark version.



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1675368889


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  var jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   it sounds good support proper inheritance between sessions, but i no full idea of implement this target, i will mark this pr as draft
   can you implement it, when complete, we will patch spark official code to our inner spark version.



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673729741


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  private[sql] val jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   @HyukjinKwon the code is here, add jobArtifactState to spark session



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on PR #47281:
URL: https://github.com/apache/spark/pull/47281#issuecomment-2222429182

   > If we want this to be done properly, I think we should refactor the whole thing. The thread local in `JobArtifactSet` has to live in SparkSession instead for example.
   
   i optimize the code by your advice before first, then research how to refactor


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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673751167


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  private[sql] val jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   We should make sure this works fine with Spark Connect. Now we're setting `session.jobArtifactState` at `withActive`, and it will overwrite session-specific jobArtifactState set in Spark Connect server.



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1675368889


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  var jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   it sounds good support proper inheritance between sessions, but i no full idea of implement this target, i will mark this pr as draft
   can you implement it continue, when complete, we will patch spark official implement to our inner spark version.



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673847215


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  private[sql] val jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   another way is maintain jobArtifactState in spark session only,  anywhere need it can get it from spark session, but this will change too many code (i think)



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673481996


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +113,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  private[sql] val jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   The change of this pr is try to reuse JobArtifactState in normal Spark sql query.
   set active jobArtifactState in each spark session make sure get right session uuid in method JobArtifactSet.getActiveOrDefault, then get isolated session aritifact set of each session.
   
   In kyuubi group share level, multi user may load their own udf jar, and may exist same udf class name in different jar, lead the first load class take effect always



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673666060


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     
+  private[sql] def cloneJobArtifactSet(parentSessionId: String,
+                                       childSessionId: String): Unit = {

Review Comment:
   ok



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673662096


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -279,6 +281,27 @@ class SparkSession private(
       initialSessionOptions)
   }
 
+  /**
+   * Clone JobArtifact set info from parent session while call cloneSession api.
+   *  
+   * @since 3.5.1 
+   */     

Review Comment:
   Let's remove this. This isn't an API



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673848641


##########
sql/core/src/main/scala/org/apache/spark/sql/artifact/ArtifactManager.scala:
##########
@@ -72,6 +72,7 @@ class ArtifactManager(session: SparkSession) extends Logging {
 
   protected[artifact] val state: JobArtifactState =
     JobArtifactState(session.sessionUUID, Option(classURI))
+  session.jobArtifactState = state

Review Comment:
   update spark session default jobArtifactState while create spark connect job artifact state
   @HyukjinKwon is this way ok?



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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #47281: [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session
URL: https://github.com/apache/spark/pull/47281


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


Re: [PR] [SPARK-48856][SQL] Use isolated JobArtifactSet for each spark session [spark]

Posted by "lifulong (via GitHub)" <gi...@apache.org>.
lifulong commented on code in PR #47281:
URL: https://github.com/apache/spark/pull/47281#discussion_r1673845445


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -113,6 +114,8 @@ class SparkSession private(
 
   private[sql] val sessionUUID: String = UUID.randomUUID.toString
 
+  private[sql] val jobArtifactState: JobArtifactState = JobArtifactState(sessionUUID, None)

Review Comment:
   yes, this is a problem, how about update session default jobArtifactState sametime when create jobArtifactState in spark connect



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