Skip to content

Commit

Permalink
Always clone parent properties
Browse files Browse the repository at this point in the history
... to make the behavior more consistent in SQL vs non-SQL cases.
  • Loading branch information
Andrew Or committed Sep 11, 2015
1 parent bbda199 commit 5297f79
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,14 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
// Thread Local variable that can be used by users to pass information down the stack
private val localProperties = new InheritableThreadLocal[Properties] {
override protected def childValue(parent: Properties): Properties = {
if (nonInheritedLocalProperties.nonEmpty) {
// If there are properties that should not be inherited, filter them out
val p = new Properties
val filtered = parent.asScala.filter { case (k, _) =>
!nonInheritedLocalProperties.contains(k)
}
p.putAll(filtered.asJava)
p
} else {
new Properties(parent)
// Note: make a clone such that changes in the parent properties aren't reflected in
// the those of the children threads, which has confusing semantics (SPARK-10564).
val p = new Properties
val filtered = parent.asScala.filter { case (k, _) =>
!nonInheritedLocalProperties.contains(k)
}
p.putAll(filtered.asJava)
p
}
override protected def initialValue(): Properties = new Properties()
}
Expand Down

0 comments on commit 5297f79

Please sign in to comment.