aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/sql/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/pyspark/sql/context.py')
-rw-r--r--python/pyspark/sql/context.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/python/pyspark/sql/context.py b/python/pyspark/sql/context.py
index 11dfcfe13e..ac98639f3a 100644
--- a/python/pyspark/sql/context.py
+++ b/python/pyspark/sql/context.py
@@ -146,13 +146,27 @@ class SQLContext(object):
"""
self._ssql_ctx.setConf(key, value)
+ @ignore_unicode_prefix
@since(1.3)
- def getConf(self, key, defaultValue):
+ def getConf(self, key, defaultValue=None):
"""Returns the value of Spark SQL configuration property for the given key.
- If the key is not set, returns defaultValue.
+ If the key is not set and defaultValue is not None, return
+ defaultValue. If the key is not set and defaultValue is None, return
+ the system default value.
+
+ >>> sqlContext.getConf("spark.sql.shuffle.partitions")
+ u'200'
+ >>> sqlContext.getConf("spark.sql.shuffle.partitions", "10")
+ u'10'
+ >>> sqlContext.setConf("spark.sql.shuffle.partitions", "50")
+ >>> sqlContext.getConf("spark.sql.shuffle.partitions", "10")
+ u'50'
"""
- return self._ssql_ctx.getConf(key, defaultValue)
+ if defaultValue is not None:
+ return self._ssql_ctx.getConf(key, defaultValue)
+ else:
+ return self._ssql_ctx.getConf(key)
@property
@since("1.3.1")