Skip to content

Commit 9f1ed92

Browse files
committed
Merge remote-tracking branch 'upstream/master' into serializer2
2 parents 6d07678 + c84d916 commit 9f1ed92

File tree

142 files changed

+2504
-1996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+2504
-1996
lines changed

R/pkg/DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ License: Apache License (== 2.0)
1717
Collate:
1818
'generics.R'
1919
'jobj.R'
20-
'SQLTypes.R'
2120
'RDD.R'
2221
'pairRDD.R'
22+
'SQLTypes.R'
2323
'column.R'
2424
'group.R'
2525
'DataFrame.R'
2626
'SQLContext.R'
27+
'backend.R'
2728
'broadcast.R'
29+
'client.R'
2830
'context.R'
2931
'deserialize.R'
3032
'serialize.R'
3133
'sparkR.R'
32-
'backend.R'
33-
'client.R'
3434
'utils.R'
3535
'zzz.R'

R/pkg/R/DataFrame.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# DataFrame.R - DataFrame class and methods implemented in S4 OO classes
1919

20-
#' @include jobj.R SQLTypes.R RDD.R pairRDD.R column.R group.R
20+
#' @include generics.R jobj.R SQLTypes.R RDD.R pairRDD.R column.R group.R
2121
NULL
2222

2323
setOldClass("jobj")

R/pkg/R/column.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# Column Class
1919

20-
#' @include generics.R jobj.R
20+
#' @include generics.R jobj.R SQLTypes.R
2121
NULL
2222

2323
setOldClass("jobj")

R/pkg/R/group.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
# group.R - GroupedData class and methods implemented in S4 OO classes
1919

20+
#' @include generics.R jobj.R SQLTypes.R column.R
21+
NULL
22+
2023
setOldClass("jobj")
2124

2225
#' @title S4 class that represents a GroupedData

R/pkg/R/jobj.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
# References to objects that exist on the JVM backend
1919
# are maintained using the jobj.
2020

21+
#' @include generics.R
22+
NULL
23+
2124
# Maintain a reference count of Java object references
2225
# This allows us to GC the java object when it is safe
2326
.validJobjs <- new.env(parent = emptyenv())

R/pkg/R/pairRDD.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#
1717

1818
# Operations supported on RDDs contains pairs (i.e key, value)
19+
#' @include generics.R jobj.R RDD.R
20+
NULL
1921

2022
############ Actions and Transformations ############
2123

bin/pyspark

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export PYTHONSTARTUP="$SPARK_HOME/python/pyspark/shell.py"
8989
if [[ -n "$SPARK_TESTING" ]]; then
9090
unset YARN_CONF_DIR
9191
unset HADOOP_CONF_DIR
92+
export PYTHONHASHSEED=0
9293
if [[ -n "$PYSPARK_DOC_TEST" ]]; then
9394
exec "$PYSPARK_DRIVER_PYTHON" -m doctest $1
9495
else

bin/spark-submit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"
2121

22+
# disable randomized hash for string in Python 3.3+
23+
export PYTHONHASHSEED=0
24+
2225
# Only define a usage function if an upstream script hasn't done so.
2326
if ! type -t usage >/dev/null 2>&1; then
2427
usage() {

bin/spark-submit2.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ rem
2020
rem This is the entry point for running Spark submit. To avoid polluting the
2121
rem environment, it just launches a new cmd to do the real work.
2222

23+
rem disable randomized hash for string in Python 3.3+
24+
set PYTHONHASHSEED=0
25+
2326
set CLASS=org.apache.spark.deploy.SparkSubmit
2427
call %~dp0spark-class2.cmd %CLASS% %*
2528
set SPARK_ERROR_LEVEL=%ERRORLEVEL%

core/src/main/resources/org/apache/spark/ui/static/webui.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,13 @@ table.sortable td {
8585
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#FFA4EDFF', endColorstr='#FF94DDFF', GradientType=0);
8686
}
8787

88-
span.kill-link {
88+
a.kill-link {
8989
margin-right: 2px;
9090
margin-left: 20px;
9191
color: gray;
9292
float: right;
9393
}
9494

95-
span.kill-link a {
96-
color: gray;
97-
}
98-
9995
span.expand-details {
10096
font-size: 10pt;
10197
cursor: pointer;

core/src/main/scala/org/apache/spark/SparkConf.scala

Lines changed: 95 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
6868
if (value == null) {
6969
throw new NullPointerException("null value for " + key)
7070
}
71+
logDeprecationWarning(key)
7172
settings.put(key, value)
7273
this
7374
}
@@ -134,13 +135,15 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
134135

135136
/** Set multiple parameters together */
136137
def setAll(settings: Traversable[(String, String)]): SparkConf = {
137-
this.settings.putAll(settings.toMap.asJava)
138+
settings.foreach { case (k, v) => set(k, v) }
138139
this
139140
}
140141

141142
/** Set a parameter if it isn't already configured */
142143
def setIfMissing(key: String, value: String): SparkConf = {
143-
settings.putIfAbsent(key, value)
144+
if (settings.putIfAbsent(key, value) == null) {
145+
logDeprecationWarning(key)
146+
}
144147
this
145148
}
146149

@@ -174,45 +177,44 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
174177
getOption(key).getOrElse(defaultValue)
175178
}
176179

177-
/**
178-
* Get a time parameter as seconds; throws a NoSuchElementException if it's not set. If no
180+
/**
181+
* Get a time parameter as seconds; throws a NoSuchElementException if it's not set. If no
179182
* suffix is provided then seconds are assumed.
180183
* @throws NoSuchElementException
181184
*/
182185
def getTimeAsSeconds(key: String): Long = {
183186
Utils.timeStringAsSeconds(get(key))
184187
}
185188

186-
/**
187-
* Get a time parameter as seconds, falling back to a default if not set. If no
189+
/**
190+
* Get a time parameter as seconds, falling back to a default if not set. If no
188191
* suffix is provided then seconds are assumed.
189-
*
190192
*/
191193
def getTimeAsSeconds(key: String, defaultValue: String): Long = {
192194
Utils.timeStringAsSeconds(get(key, defaultValue))
193195
}
194196

195-
/**
196-
* Get a time parameter as milliseconds; throws a NoSuchElementException if it's not set. If no
197-
* suffix is provided then milliseconds are assumed.
197+
/**
198+
* Get a time parameter as milliseconds; throws a NoSuchElementException if it's not set. If no
199+
* suffix is provided then milliseconds are assumed.
198200
* @throws NoSuchElementException
199201
*/
200202
def getTimeAsMs(key: String): Long = {
201203
Utils.timeStringAsMs(get(key))
202204
}
203205

204-
/**
205-
* Get a time parameter as milliseconds, falling back to a default if not set. If no
206-
* suffix is provided then milliseconds are assumed.
206+
/**
207+
* Get a time parameter as milliseconds, falling back to a default if not set. If no
208+
* suffix is provided then milliseconds are assumed.
207209
*/
208210
def getTimeAsMs(key: String, defaultValue: String): Long = {
209211
Utils.timeStringAsMs(get(key, defaultValue))
210212
}
211-
213+
212214

213215
/** Get a parameter as an Option */
214216
def getOption(key: String): Option[String] = {
215-
Option(settings.get(key))
217+
Option(settings.get(key)).orElse(getDeprecatedConfig(key, this))
216218
}
217219

218220
/** Get all parameters as a list of pairs */
@@ -379,13 +381,6 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
379381
}
380382
}
381383
}
382-
383-
// Warn against the use of deprecated configs
384-
deprecatedConfigs.values.foreach { dc =>
385-
if (contains(dc.oldName)) {
386-
dc.warn()
387-
}
388-
}
389384
}
390385

391386
/**
@@ -400,19 +395,44 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
400395

401396
private[spark] object SparkConf extends Logging {
402397

398+
/**
399+
* Maps deprecated config keys to information about the deprecation.
400+
*
401+
* The extra information is logged as a warning when the config is present in the user's
402+
* configuration.
403+
*/
403404
private val deprecatedConfigs: Map[String, DeprecatedConfig] = {
404405
val configs = Seq(
405-
DeprecatedConfig("spark.files.userClassPathFirst", "spark.executor.userClassPathFirst",
406-
"1.3"),
407-
DeprecatedConfig("spark.yarn.user.classpath.first", null, "1.3",
408-
"Use spark.{driver,executor}.userClassPathFirst instead."),
409-
DeprecatedConfig("spark.history.fs.updateInterval",
410-
"spark.history.fs.update.interval.seconds",
411-
"1.3", "Use spark.history.fs.update.interval.seconds instead"),
412-
DeprecatedConfig("spark.history.updateInterval",
413-
"spark.history.fs.update.interval.seconds",
414-
"1.3", "Use spark.history.fs.update.interval.seconds instead"))
415-
configs.map { x => (x.oldName, x) }.toMap
406+
DeprecatedConfig("spark.yarn.user.classpath.first", "1.3",
407+
"Please use spark.{driver,executor}.userClassPathFirst instead."))
408+
Map(configs.map { cfg => (cfg.key -> cfg) }:_*)
409+
}
410+
411+
/**
412+
* Maps a current config key to alternate keys that were used in previous version of Spark.
413+
*
414+
* The alternates are used in the order defined in this map. If deprecated configs are
415+
* present in the user's configuration, a warning is logged.
416+
*/
417+
private val configsWithAlternatives = Map[String, Seq[AlternateConfig]](
418+
"spark.executor.userClassPathFirst" -> Seq(
419+
AlternateConfig("spark.files.userClassPathFirst", "1.3")),
420+
"spark.history.fs.update.interval" -> Seq(
421+
AlternateConfig("spark.history.fs.update.interval.seconds", "1.4"),
422+
AlternateConfig("spark.history.fs.updateInterval", "1.3"),
423+
AlternateConfig("spark.history.updateInterval", "1.3"))
424+
)
425+
426+
/**
427+
* A view of `configsWithAlternatives` that makes it more efficient to look up deprecated
428+
* config keys.
429+
*
430+
* Maps the deprecated config name to a 2-tuple (new config name, alternate config info).
431+
*/
432+
private val allAlternatives: Map[String, (String, AlternateConfig)] = {
433+
configsWithAlternatives.keys.flatMap { key =>
434+
configsWithAlternatives(key).map { cfg => (cfg.key -> (key -> cfg)) }
435+
}.toMap
416436
}
417437

418438
/**
@@ -443,61 +463,57 @@ private[spark] object SparkConf extends Logging {
443463
}
444464

445465
/**
446-
* Translate the configuration key if it is deprecated and has a replacement, otherwise just
447-
* returns the provided key.
448-
*
449-
* @param userKey Configuration key from the user / caller.
450-
* @param warn Whether to print a warning if the key is deprecated. Warnings will be printed
451-
* only once for each key.
466+
* Looks for available deprecated keys for the given config option, and return the first
467+
* value available.
452468
*/
453-
private def translateConfKey(userKey: String, warn: Boolean = false): String = {
454-
deprecatedConfigs.get(userKey)
455-
.map { deprecatedKey =>
456-
if (warn) {
457-
deprecatedKey.warn()
458-
}
459-
deprecatedKey.newName.getOrElse(userKey)
460-
}.getOrElse(userKey)
469+
def getDeprecatedConfig(key: String, conf: SparkConf): Option[String] = {
470+
configsWithAlternatives.get(key).flatMap { alts =>
471+
alts.collectFirst { case alt if conf.contains(alt.key) =>
472+
val value = conf.get(alt.key)
473+
alt.translation.map(_(value)).getOrElse(value)
474+
}
475+
}
461476
}
462477

463478
/**
464-
* Holds information about keys that have been deprecated or renamed.
479+
* Logs a warning message if the given config key is deprecated.
480+
*/
481+
def logDeprecationWarning(key: String): Unit = {
482+
deprecatedConfigs.get(key).foreach { cfg =>
483+
logWarning(
484+
s"The configuration key '$key' has been deprecated as of Spark ${cfg.version} and " +
485+
s"may be removed in the future. ${cfg.deprecationMessage}")
486+
}
487+
488+
allAlternatives.get(key).foreach { case (newKey, cfg) =>
489+
logWarning(
490+
s"The configuration key '$key' has been deprecated as of Spark ${cfg.version} and " +
491+
s"and may be removed in the future. Please use the new key '$newKey' instead.")
492+
}
493+
}
494+
495+
/**
496+
* Holds information about keys that have been deprecated and do not have a replacement.
465497
*
466-
* @param oldName Old configuration key.
467-
* @param newName New configuration key, or `null` if key has no replacement, in which case the
468-
* deprecated key will be used (but the warning message will still be printed).
498+
* @param key The deprecated key.
469499
* @param version Version of Spark where key was deprecated.
470-
* @param deprecationMessage Message to include in the deprecation warning; mandatory when
471-
* `newName` is not provided.
500+
* @param deprecationMessage Message to include in the deprecation warning.
472501
*/
473502
private case class DeprecatedConfig(
474-
oldName: String,
475-
_newName: String,
503+
key: String,
476504
version: String,
477-
deprecationMessage: String = null) {
478-
479-
private val warned = new AtomicBoolean(false)
480-
val newName = Option(_newName)
505+
deprecationMessage: String)
481506

482-
if (newName == null && (deprecationMessage == null || deprecationMessage.isEmpty())) {
483-
throw new IllegalArgumentException("Need new config name or deprecation message.")
484-
}
485-
486-
def warn(): Unit = {
487-
if (warned.compareAndSet(false, true)) {
488-
if (newName != null) {
489-
val message = Option(deprecationMessage).getOrElse(
490-
s"Please use the alternative '$newName' instead.")
491-
logWarning(
492-
s"The configuration option '$oldName' has been replaced as of Spark $version and " +
493-
s"may be removed in the future. $message")
494-
} else {
495-
logWarning(
496-
s"The configuration option '$oldName' has been deprecated as of Spark $version and " +
497-
s"may be removed in the future. $deprecationMessage")
498-
}
499-
}
500-
}
507+
/**
508+
* Information about an alternate configuration key that has been deprecated.
509+
*
510+
* @param key The deprecated config key.
511+
* @param version The Spark version in which the key was deprecated.
512+
* @param translation A translation function for converting old config values into new ones.
513+
*/
514+
private case class AlternateConfig(
515+
key: String,
516+
version: String,
517+
translation: Option[String => String] = None)
501518

502-
}
503519
}

0 commit comments

Comments
 (0)