zhengruifeng commented on code in PR #39146:
URL: https://github.com/apache/spark/pull/39146#discussion_r1054095381


##########
python/pyspark/ml/torch/utils.py:
##########
@@ -0,0 +1,24 @@
+from pyspark.context import SparkContext
+
+def get_conf_boolean(sc: SparkContext, key: str, default_value: str):
+        """
+        Get the conf "key" from the given spark context,
+        or return the default value if the conf is not set.
+        This expects the conf value to be a boolean or string;
+        if the value is a string, this checks for all capitalization
+        patterns of "true" and "false" to match Scala.
+        Args:
+            key: string for conf name
+            default_value: default value for the conf value for the given key
+        """
+        val = sc.getConf().get(key, default_value)
+        lowercase_val = val.lower()
+        if lowercase_val == "true":
+            return True
+        if lowercase_val == "false":
+            return False
+        raise Exception(
+            "_getConfBoolean expected a boolean conf "

Review Comment:
   ```suggestion
               "get_conf_boolean expected a boolean conf "
   ```



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