Skip to content

Commit 7126907

Browse files
authored
Merge pull request apache#109 from Wayne1c/ke-13010
apache#11 SQLConf support thread local prop
2 parents 529ae3e + 49a5bae commit 7126907

File tree

28 files changed

+56
-29
lines changed

28 files changed

+56
-29
lines changed

assembly/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>org.apache.spark</groupId>
2323
<artifactId>spark-parent_2.11</artifactId>
24-
<version>2.2.1-kylin-r9</version>
24+
<version>2.2.1-kylin-r10</version>
2525
<relativePath>../pom.xml</relativePath>
2626
</parent>
2727

common/network-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.apache.spark</groupId>
2424
<artifactId>spark-parent_2.11</artifactId>
25-
<version>2.2.1-kylin-r9</version>
25+
<version>2.2.1-kylin-r10</version>
2626
<relativePath>../../pom.xml</relativePath>
2727
</parent>
2828

common/network-shuffle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.apache.spark</groupId>
2424
<artifactId>spark-parent_2.11</artifactId>
25-
<version>2.2.1-kylin-r9</version>
25+
<version>2.2.1-kylin-r10</version>
2626
<relativePath>../../pom.xml</relativePath>
2727
</parent>
2828

common/sketch/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.apache.spark</groupId>
2424
<artifactId>spark-parent_2.11</artifactId>
25-
<version>2.2.1-kylin-r9</version>
25+
<version>2.2.1-kylin-r10</version>
2626
<relativePath>../../pom.xml</relativePath>
2727
</parent>
2828

common/tags/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.apache.spark</groupId>
2424
<artifactId>spark-parent_2.11</artifactId>
25-
<version>2.2.1-kylin-r9</version>
25+
<version>2.2.1-kylin-r10</version>
2626
<relativePath>../../pom.xml</relativePath>
2727
</parent>
2828

common/unsafe/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.apache.spark</groupId>
2424
<artifactId>spark-parent_2.11</artifactId>
25-
<version>2.2.1-kylin-r9</version>
25+
<version>2.2.1-kylin-r10</version>
2626
<relativePath>../../pom.xml</relativePath>
2727
</parent>
2828

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>org.apache.spark</groupId>
2323
<artifactId>spark-parent_2.11</artifactId>
24-
<version>2.2.1-kylin-r9</version>
24+
<version>2.2.1-kylin-r10</version>
2525
<relativePath>../pom.xml</relativePath>
2626
</parent>
2727

core/src/main/scala/org/apache/spark/internal/config/ConfigReader.scala

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import java.util.{Map => JMap}
2222
import scala.collection.mutable.HashMap
2323
import scala.util.matching.Regex
2424

25+
import org.apache.commons.lang3.SerializationUtils
26+
2527
private object ConfigReader {
2628

2729
private val REF_RE = "\\$\\{(?:(\\w+?):)?(\\S+?)\\}".r
@@ -56,6 +58,17 @@ private[spark] class ConfigReader(conf: ConfigProvider) {
5658
bindEnv(new EnvProvider())
5759
bindSystem(new SystemProvider())
5860

61+
protected[spark] val localProperties =
62+
new InheritableThreadLocal[java.util.HashMap[String, String]] {
63+
override protected def childValue(parent: java.util.HashMap[String, String]):
64+
java.util.HashMap[String, String] = {
65+
// Note: make a clone such that changes in the parent properties aren't reflected in
66+
// the those of the children threads, which has confusing semantics (SPARK-10563).
67+
SerializationUtils.clone(parent)
68+
}
69+
override protected def initialValue(): java.util.HashMap[String, String] =
70+
new java.util.HashMap[String, String]()
71+
}
5972
/**
6073
* Binds a prefix to a provider. This method is not thread-safe and should be called
6174
* before the instance is used to expand values.
@@ -76,7 +89,9 @@ private[spark] class ConfigReader(conf: ConfigProvider) {
7689
/**
7790
* Reads a configuration key from the default provider, and apply variable substitution.
7891
*/
79-
def get(key: String): Option[String] = conf.get(key).map(substitute)
92+
def get(key: String): Option[String] = {
93+
Option(localProperties.get().get(key)).orElse(conf.get(key)).map(substitute)
94+
}
8095

8196
/**
8297
* Perform variable substitution on the given input string.

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>org.apache.spark</groupId>
2323
<artifactId>spark-parent_2.11</artifactId>
24-
<version>2.2.1-kylin-r9</version>
24+
<version>2.2.1-kylin-r10</version>
2525
<relativePath>../pom.xml</relativePath>
2626
</parent>
2727

external/flume-assembly/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>org.apache.spark</groupId>
2323
<artifactId>spark-parent_2.11</artifactId>
24-
<version>2.2.1-kylin-r9</version>
24+
<version>2.2.1-kylin-r10</version>
2525
<relativePath>../../pom.xml</relativePath>
2626
</parent>
2727

0 commit comments

Comments
 (0)