File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/test Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 17
17
18
18
package org .apache .spark .sql .catalyst .test
19
19
20
- import org .apache .spark .sql .catalyst .CatalystConf
21
-
22
20
import scala .collection .immutable
23
- import scala .collection .mutable
21
+ import scala .collection .JavaConversions ._
22
+
23
+ import org .apache .spark .sql .catalyst .CatalystConf
24
24
25
25
/** A CatalystConf that can be used for local testing. */
26
26
class SimpleCatalystConf (caseSensitive : Boolean ) extends CatalystConf {
27
- val map = mutable.Map [String , String ]()
27
+ val settings = java.util.Collections .synchronizedMap(
28
+ new java.util.HashMap [String , String ]())
28
29
29
30
override def caseSensitiveAnalysis : Boolean = caseSensitive
30
31
31
32
override def setConf (key : String , value : String ) : Unit = {
32
- map .put(key, value)
33
+ settings .put(key, value)
33
34
}
35
+
34
36
override def getConf (key : String ) : String = {
35
- map .get(key).get
37
+ settings .get(key)
36
38
}
39
+
37
40
override def getConf (key : String , defaultValue : String ) : String = {
38
- map.getOrElse (key, defaultValue)
41
+ Option (settings.get (key)).getOrElse( defaultValue)
39
42
}
40
- override def getAllConfs : immutable.Map [String , String ] = {
41
- map.toMap
43
+
44
+ override def getAllConfs : immutable.Map [String , String ] = settings.synchronized {
45
+ settings.toMap
42
46
}
43
47
}
You can’t perform that action at this time.
0 commit comments