dongjoon-hyun commented on code in PR #48781:
URL: https://github.com/apache/spark/pull/48781#discussion_r1831785988


##########
python/pyspark/core/context.py:
##########
@@ -554,6 +554,28 @@ def setSystemProperty(cls, key: str, value: str) -> None:
         assert SparkContext._jvm is not None
         SparkContext._jvm.java.lang.System.setProperty(key, value)
 
+    @classmethod
+    def getSystemProperty(cls, key: str) -> str:
+        """
+        Get a Java system property, such as `java.home`.
+
+        .. versionadded:: 4.0.0
+
+        Parameters
+        ----------
+        key : str
+            The key of a new Java system property.
+
+        Examples
+        --------
+        >>> sc.getSystemProperty("SPARK_SUBMIT")
+        'true'
+        >>> _ = sc.getSystemProperty("java.home")
+        """
+        SparkContext._ensure_initialized()
+        assert SparkContext._jvm is not None
+        return SparkContext._jvm.java.lang.System.getProperty(key)

Review Comment:
   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.
   
   > 
https://spark.apache.org/docs/4.0.0-preview2/api/python/reference/api/pyspark.SparkContext.setSystemProperty.html



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