[SPARK-43574][PYTHON][SQL] Support to set Python executable for UDF and pandas function APIs in workers during runtime#41215
Closed
HyukjinKwon wants to merge 1 commit intoapache:masterfrom
Closed
Conversation
dongjoon-hyun
approved these changes
May 18, 2023
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM.
Merged to master for Apache Spark 3.5.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR proposes a new configuration
spark.sql.execution.pyspark.pythonthat sets the Python executable on worker nodes.Note that, if the Python executable is different from the one previously ran, it will creates a new Python worker processes because we reuse Python workers but they are unique by both executable path and env variables as a key:
spark/core/src/main/scala/org/apache/spark/SparkEnv.scala
Lines 123 to 124 in d7a8b85
This PR is also a basework for Spark Connect to support a different set of dependencies.
Why are the changes needed?
This can be useful especially when you want to run your Python with a different set of dependencies during runtime (see also https://www.databricks.com/blog/2020/12/22/how-to-manage-python-dependencies-in-pyspark.html)
Does this PR introduce any user-facing change?
No, this PR adds a configuration but that's internal for now.
How was this patch tested?
Manually tested as below: