dchvn commented on a change in pull request #34238:
URL: https://github.com/apache/spark/pull/34238#discussion_r726047716
##########
File path: python/pyspark/conf.py
##########
@@ -133,39 +141,52 @@ def set(self, key, value):
self._conf[key] = str(value)
return self
- def setIfMissing(self, key, value):
+ def setIfMissing(self, key: str, value: str) -> "SparkConf":
"""Set a configuration property, if not already set."""
if self.get(key) is None:
self.set(key, value)
return self
- def setMaster(self, value):
+ def setMaster(self, value: str) -> "SparkConf":
"""Set master URL to connect to."""
self.set("spark.master", value)
return self
- def setAppName(self, value):
+ def setAppName(self, value: str) -> "SparkConf":
"""Set application name."""
self.set("spark.app.name", value)
return self
- def setSparkHome(self, value):
+ def setSparkHome(self, value: str) -> "SparkConf":
"""Set path where Spark is installed on worker nodes."""
self.set("spark.home", value)
return self
- def setExecutorEnv(self, key=None, value=None, pairs=None):
+ @overload
+ def setExecutorEnv(self, key: str, value: str) -> "SparkConf":
+ ...
+
+ @overload
+ def setExecutorEnv(self, *, pairs: List[Tuple[str, str]]) -> "SparkConf":
+ ...
+
+ def setExecutorEnv(
+ self,
+ key: Optional[str] = None,
+ value: Optional[str] = None,
+ pairs: Optional[List[Tuple[str, str]]] = None
+ ) -> "SparkConf":
"""Set an environment variable to be passed to executors."""
if (key is not None and pairs is not None) or (key is None and pairs
is None):
raise RuntimeError("Either pass one key-value pair or a list of
pairs")
- elif key is not None:
+ elif key is not None and value is not None:
Review comment:
thanks, updated
--
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]