Github user BryanCutler commented on a diff in the pull request:
https://github.com/apache/spark/pull/14959#discussion_r80561545
--- Diff: python/pyspark/conf.py ---
@@ -101,13 +101,25 @@ def __init__(self, loadDefaults=True, _jvm=None,
_jconf=None):
self._jconf = _jconf
else:
from pyspark.context import SparkContext
- SparkContext._ensure_initialized()
_jvm = _jvm or SparkContext._jvm
- self._jconf = _jvm.SparkConf(loadDefaults)
+
+ if _jvm:
+ # JVM is created, so create self._jconf directly through
JVM
+ self._jconf = _jvm.SparkConf(loadDefaults)
+ self._conf = None
+ else:
+ # JVM is not created, so store data in self._conf first
+ self._jconf = None
+ self._conf = {}
def set(self, key, value):
"""Set a configuration property."""
- self._jconf.set(key, unicode(value))
+ # Try to set self._jconf first if JVM is created, set self._conf
if JVM is not created yet.
+ if self._jconf:
--- End diff --
minor: I think it's generally better and would be more consistent with the
rest of the code if you made these checks against a `None` value, here and
other places in this PR. For example:
```python
if self._jconf is not None:
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]