Skip to content

Commit 0e8203f

Browse files
ScrapCodespwendell
authored andcommitted
[SPARK-2924] Required by scala 2.11, only one fun/ctor amongst overriden alternatives, can have default argument(s).
...riden alternatives, can have default argument. Author: Prashant Sharma <[email protected]> Closes apache#2750 from ScrapCodes/SPARK-2924/default-args-removed and squashes the following commits: d9785c3 [Prashant Sharma] [SPARK-2924] Required by scala 2.11, only one function/ctor amongst overriden alternatives, can have default argument.
1 parent 1d72a30 commit 0e8203f

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

core/src/main/scala/org/apache/spark/util/FileLogger.scala

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,27 @@ private[spark] class FileLogger(
5151
def this(
5252
logDir: String,
5353
sparkConf: SparkConf,
54-
compress: Boolean = false,
55-
overwrite: Boolean = true) = {
54+
compress: Boolean,
55+
overwrite: Boolean) = {
5656
this(logDir, sparkConf, SparkHadoopUtil.get.newConfiguration(sparkConf), compress = compress,
5757
overwrite = overwrite)
5858
}
5959

60+
def this(
61+
logDir: String,
62+
sparkConf: SparkConf,
63+
compress: Boolean) = {
64+
this(logDir, sparkConf, SparkHadoopUtil.get.newConfiguration(sparkConf), compress = compress,
65+
overwrite = true)
66+
}
67+
68+
def this(
69+
logDir: String,
70+
sparkConf: SparkConf) = {
71+
this(logDir, sparkConf, SparkHadoopUtil.get.newConfiguration(sparkConf), compress = false,
72+
overwrite = true)
73+
}
74+
6075
private val dateFormat = new ThreadLocal[SimpleDateFormat]() {
6176
override def initialValue(): SimpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
6277
}

core/src/test/scala/org/apache/spark/util/FileLoggerSuite.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ class FileLoggerSuite extends FunSuite with BeforeAndAfter {
7474

7575
test("Logging when directory already exists") {
7676
// Create the logging directory multiple times
77-
new FileLogger(logDirPathString, new SparkConf, overwrite = true).start()
78-
new FileLogger(logDirPathString, new SparkConf, overwrite = true).start()
79-
new FileLogger(logDirPathString, new SparkConf, overwrite = true).start()
77+
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = true).start()
78+
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = true).start()
79+
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = true).start()
8080

8181
// If overwrite is not enabled, an exception should be thrown
8282
intercept[IOException] {
83-
new FileLogger(logDirPathString, new SparkConf, overwrite = false).start()
83+
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = false).start()
8484
}
8585
}
8686

0 commit comments

Comments
 (0)