-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-50251][PYTHON] Add getSystemProperty
to PySpark SparkContext
#48781
Conversation
Could you review this, @xinrong-meng and @zhengruifeng ? |
c693bf8
to
cdf5ede
Compare
Could you review this PR too, @HyukjinKwon ? |
""" | ||
SparkContext._ensure_initialized() | ||
assert SparkContext._jvm is not None | ||
return SparkContext._jvm.java.lang.System.getProperty(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
three questions:
1, shall we name it to be more specific to the Java?
2, do we need to also introduce it in Scala side?
3, shall we make it a SparkSession method? so that we can implement it in SparkConnect later
also cc @cloud-fan for this new feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To @zhengruifeng , as I wrote in the PR description, this is a symmetric version of the existing setSystemProperty
. So, no for (1) and (3). For (2), Scala can access System.getProperty
directly already.
Could you review this PR, @viirya ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from my side for polyglot feature parity
Thank you so much, @yaooqinn ! |
Thank you, @viirya ! |
Merged to master. Thank you all. |
Late LGTM, thanks! |
Thank you, @zhengruifeng |
What changes were proposed in this pull request?
This PR aims to add
getSystemProperty
to PySparkSparkContext
likesetSystemProperty
at Apache Spark 4.0.0.https://spark.apache.org/docs/4.0.0-preview2/api/python/reference/api/pyspark.SparkContext.setSystemProperty.html
Why are the changes needed?
Since Apache Spark 0.9.0,
setSystemProperty
has been provided because Python doesn't have JVM'sSystemProperties
concept. This is usefully used like the following.spark/python/pyspark/shell.py
Line 84 in 99d27c9
This PR aims to add
getSystemProperty
additionally and symmetrically to provide an easier and better experience for both Spark developers and Spark App developers.Does this PR introduce any user-facing change?
No. This is a new API.
How was this patch tested?
Pass the CIs with newly added doctests.
Was this patch authored or co-authored using generative AI tooling?
No.