Skip to content

Commit 713868f

Browse files
author
Andrew Or
committed
Fix compilation issue for scala 2.11
1 parent 7ff16e8 commit 713868f

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

core/src/main/scala/org/apache/spark/rdd/RDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ abstract class RDD[T: ClassTag](
15241524
* doCheckpoint() is called recursively on the parent RDDs.
15251525
*/
15261526
private[spark] def doCheckpoint(): Unit = {
1527-
RDDOperationScope.withScope(sc, "checkpoint", false, true) {
1527+
RDDOperationScope.withScope(sc, "checkpoint", allowNesting = false, ignoreParent = true) {
15281528
if (!doCheckpointCalled) {
15291529
doCheckpointCalled = true
15301530
if (checkpointData.isDefined) {

core/src/main/scala/org/apache/spark/rdd/RDDOperationScope.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private[spark] object RDDOperationScope {
9696
sc: SparkContext,
9797
allowNesting: Boolean = false)(body: => T): T = {
9898
val callerMethodName = Thread.currentThread.getStackTrace()(3).getMethodName
99-
withScope[T](sc, callerMethodName, allowNesting)(body)
99+
withScope[T](sc, callerMethodName, allowNesting, ignoreParent = false)(body)
100100
}
101101

102102
/**
@@ -116,7 +116,7 @@ private[spark] object RDDOperationScope {
116116
sc: SparkContext,
117117
name: String,
118118
allowNesting: Boolean,
119-
ignoreParent: Boolean = false)(body: => T): T = {
119+
ignoreParent: Boolean)(body: => T): T = {
120120
// Save the old scope to restore it later
121121
val scopeKey = SparkContext.RDD_SCOPE_KEY
122122
val noOverrideKey = SparkContext.RDD_SCOPE_NO_OVERRIDE_KEY

core/src/test/scala/org/apache/spark/rdd/RDDOperationScopeSuite.scala

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ class RDDOperationScopeSuite extends FunSuite with BeforeAndAfter {
6161
var rdd1: MyCoolRDD = null
6262
var rdd2: MyCoolRDD = null
6363
var rdd3: MyCoolRDD = null
64-
RDDOperationScope.withScope(sc, "scope1", allowNesting = false) {
64+
RDDOperationScope.withScope(sc, "scope1", allowNesting = false, ignoreParent = false) {
6565
rdd1 = new MyCoolRDD(sc)
66-
RDDOperationScope.withScope(sc, "scope2", allowNesting = false) {
66+
RDDOperationScope.withScope(sc, "scope2", allowNesting = false, ignoreParent = false) {
6767
rdd2 = new MyCoolRDD(sc)
68-
RDDOperationScope.withScope(sc, "scope3", allowNesting = false) {
68+
RDDOperationScope.withScope(sc, "scope3", allowNesting = false, ignoreParent = false) {
6969
rdd3 = new MyCoolRDD(sc)
7070
}
7171
}
@@ -84,11 +84,13 @@ class RDDOperationScopeSuite extends FunSuite with BeforeAndAfter {
8484
var rdd1: MyCoolRDD = null
8585
var rdd2: MyCoolRDD = null
8686
var rdd3: MyCoolRDD = null
87-
RDDOperationScope.withScope(sc, "scope1", allowNesting = true) { // allow nesting here
87+
// allow nesting here
88+
RDDOperationScope.withScope(sc, "scope1", allowNesting = true, ignoreParent = false) {
8889
rdd1 = new MyCoolRDD(sc)
89-
RDDOperationScope.withScope(sc, "scope2", allowNesting = false) { // stop nesting here
90+
// stop nesting here
91+
RDDOperationScope.withScope(sc, "scope2", allowNesting = false, ignoreParent = false) {
9092
rdd2 = new MyCoolRDD(sc)
91-
RDDOperationScope.withScope(sc, "scope3", allowNesting = false) {
93+
RDDOperationScope.withScope(sc, "scope3", allowNesting = false, ignoreParent = false) {
9294
rdd3 = new MyCoolRDD(sc)
9395
}
9496
}
@@ -107,11 +109,11 @@ class RDDOperationScopeSuite extends FunSuite with BeforeAndAfter {
107109
var rdd1: MyCoolRDD = null
108110
var rdd2: MyCoolRDD = null
109111
var rdd3: MyCoolRDD = null
110-
RDDOperationScope.withScope(sc, "scope1", allowNesting = true) {
112+
RDDOperationScope.withScope(sc, "scope1", allowNesting = true, ignoreParent = false) {
111113
rdd1 = new MyCoolRDD(sc)
112-
RDDOperationScope.withScope(sc, "scope2", allowNesting = true) {
114+
RDDOperationScope.withScope(sc, "scope2", allowNesting = true, ignoreParent = false) {
113115
rdd2 = new MyCoolRDD(sc)
114-
RDDOperationScope.withScope(sc, "scope3", allowNesting = true) {
116+
RDDOperationScope.withScope(sc, "scope3", allowNesting = true, ignoreParent = false) {
115117
rdd3 = new MyCoolRDD(sc)
116118
}
117119
}

0 commit comments

Comments
 (0)