diff options
author | baishuo(白硕) <vc_java@hotmail.com> | 2014-07-04 00:25:31 -0700 |
---|---|---|
committer | Reynold Xin <rxin@apache.org> | 2014-07-04 00:25:46 -0700 |
commit | dc73ee13c83e81f21c978f3a92a126f3b08eb56f (patch) | |
tree | a065c46e2840cf6061efdfbf2ae1945dfb709e0d /sql/core | |
parent | 6e0b7e5308263bef60120debe05577868ebaeea9 (diff) | |
download | spark-dc73ee13c83e81f21c978f3a92a126f3b08eb56f.tar.gz spark-dc73ee13c83e81f21c978f3a92a126f3b08eb56f.tar.bz2 spark-dc73ee13c83e81f21c978f3a92a126f3b08eb56f.zip |
Update SQLConf.scala
use concurrent.ConcurrentHashMap instead of util.Collections.synchronizedMap
Author: baishuo(白硕) <vc_java@hotmail.com>
Closes #1272 from baishuo/master and squashes the following commits:
51ec55d [baishuo(白硕)] Update SQLConf.scala
63da043 [baishuo(白硕)] Update SQLConf.scala
36b6dbd [baishuo(白硕)] Update SQLConf.scala
864faa0 [baishuo(白硕)] Update SQLConf.scala
593096b [baishuo(白硕)] Update SQLConf.scala
7304d9b [baishuo(白硕)] Update SQLConf.scala
843581c [baishuo(白硕)] Update SQLConf.scala
1d3e4a2 [baishuo(白硕)] Update SQLConf.scala
0740f28 [baishuo(白硕)] Update SQLConf.scala
(cherry picked from commit 0bbe61223eda3f33bbf8992d2a8f0d47813f4873)
Signed-off-by: Reynold Xin <rxin@apache.org>
Diffstat (limited to 'sql/core')
-rw-r--r-- | sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala b/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala index b378252ba2..64b950331e 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala @@ -47,20 +47,17 @@ trait SQLConf { } def get(key: String): String = { - if (!settings.containsKey(key)) { - throw new NoSuchElementException(key) - } - settings.get(key) + Option(settings.get(key)).getOrElse(throw new NoSuchElementException(key)) } def get(key: String, defaultValue: String): String = { - if (!settings.containsKey(key)) defaultValue else settings.get(key) + Option(settings.get(key)).getOrElse(defaultValue) } def getAll: Array[(String, String)] = settings.asScala.toArray def getOption(key: String): Option[String] = { - if (!settings.containsKey(key)) None else Some(settings.get(key)) + Option(settings.get(key)) } def contains(key: String): Boolean = settings.containsKey(key) |