Skip to content

Commit 12151e6

Browse files
Merge remote-tracking branch 'upstream/master' into SPARK-3278
2 parents 7aca4cc + ea74365 commit 12151e6

File tree

173 files changed

+5274
-3494
lines changed

Some content is hidden

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

173 files changed

+5274
-3494
lines changed

bin/compute-classpath.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,25 @@ else
7272
assembly_folder="$ASSEMBLY_DIR"
7373
fi
7474

75-
num_jars="$(ls "$assembly_folder" | grep "spark-assembly.*hadoop.*\.jar$" | wc -l)"
76-
if [ "$num_jars" -eq "0" ]; then
77-
echo "Failed to find Spark assembly in $assembly_folder"
78-
echo "You need to build Spark before running this program."
79-
exit 1
80-
fi
75+
num_jars=0
76+
77+
for f in ${assembly_folder}/spark-assembly*hadoop*.jar; do
78+
if [[ ! -e "$f" ]]; then
79+
echo "Failed to find Spark assembly in $assembly_folder" 1>&2
80+
echo "You need to build Spark before running this program." 1>&2
81+
exit 1
82+
fi
83+
ASSEMBLY_JAR="$f"
84+
num_jars=$((num_jars+1))
85+
done
86+
8187
if [ "$num_jars" -gt "1" ]; then
82-
jars_list=$(ls "$assembly_folder" | grep "spark-assembly.*hadoop.*.jar$")
83-
echo "Found multiple Spark assembly jars in $assembly_folder:"
84-
echo "$jars_list"
85-
echo "Please remove all but one jar."
88+
echo "Found multiple Spark assembly jars in $assembly_folder:" 1>&2
89+
ls ${assembly_folder}/spark-assembly*hadoop*.jar 1>&2
90+
echo "Please remove all but one jar." 1>&2
8691
exit 1
8792
fi
8893

89-
ASSEMBLY_JAR="$(ls "$assembly_folder"/spark-assembly*hadoop*.jar 2>/dev/null)"
90-
9194
# Verify that versions of java used to build the jars and run Spark are compatible
9295
jar_error_check=$("$JAR_CMD" -tf "$ASSEMBLY_JAR" nonexistent/class/path 2>&1)
9396
if [[ "$jar_error_check" =~ "invalid CEN header" ]]; then

bin/run-example

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,32 @@ else
3535
fi
3636

3737
if [ -f "$FWDIR/RELEASE" ]; then
38-
export SPARK_EXAMPLES_JAR="`ls "$FWDIR"/lib/spark-examples-*hadoop*.jar`"
39-
elif [ -e "$EXAMPLES_DIR"/target/scala-$SPARK_SCALA_VERSION/spark-examples-*hadoop*.jar ]; then
40-
export SPARK_EXAMPLES_JAR="`ls "$EXAMPLES_DIR"/target/scala-$SPARK_SCALA_VERSION/spark-examples-*hadoop*.jar`"
38+
JAR_PATH="${FWDIR}/lib"
39+
else
40+
JAR_PATH="${EXAMPLES_DIR}/target/scala-${SPARK_SCALA_VERSION}"
4141
fi
4242

43-
if [[ -z "$SPARK_EXAMPLES_JAR" ]]; then
44-
echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" 1>&2
45-
echo "You need to build Spark before running this program" 1>&2
43+
JAR_COUNT=0
44+
45+
for f in ${JAR_PATH}/spark-examples-*hadoop*.jar; do
46+
if [[ ! -e "$f" ]]; then
47+
echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" 1>&2
48+
echo "You need to build Spark before running this program" 1>&2
49+
exit 1
50+
fi
51+
SPARK_EXAMPLES_JAR="$f"
52+
JAR_COUNT=$((JAR_COUNT+1))
53+
done
54+
55+
if [ "$JAR_COUNT" -gt "1" ]; then
56+
echo "Found multiple Spark examples assembly jars in ${JAR_PATH}" 1>&2
57+
ls ${JAR_PATH}/spark-examples-*hadoop*.jar 1>&2
58+
echo "Please remove all but one jar." 1>&2
4659
exit 1
4760
fi
4861

62+
export SPARK_EXAMPLES_JAR
63+
4964
EXAMPLE_MASTER=${MASTER:-"local[*]"}
5065

5166
if [[ ! $EXAMPLE_CLASS == org.apache.spark.examples* ]]; then

bin/spark-class

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ case "$1" in
7171
'org.apache.spark.executor.MesosExecutorBackend')
7272
OUR_JAVA_OPTS="$SPARK_JAVA_OPTS $SPARK_EXECUTOR_OPTS"
7373
OUR_JAVA_MEM=${SPARK_EXECUTOR_MEMORY:-$DEFAULT_MEM}
74+
export PYTHONPATH="$FWDIR/python:$PYTHONPATH"
75+
export PYTHONPATH="$FWDIR/python/lib/py4j-0.8.2.1-src.zip:$PYTHONPATH"
7476
;;
7577

7678
# Spark submit uses SPARK_JAVA_OPTS + SPARK_SUBMIT_OPTS +

core/src/main/resources/org/apache/spark/log4j-defaults.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ log4j.logger.org.eclipse.jetty=WARN
1010
log4j.logger.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
1111
log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO
1212
log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO
13+
log4j.logger.org.apache.hadoop.yarn.util.RackResolver=WARN

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ pre {
121121
border: none;
122122
}
123123

124+
.description-input {
125+
overflow: hidden;
126+
text-overflow: ellipsis;
127+
width: 100%;
128+
white-space: nowrap;
129+
display: block;
130+
}
131+
124132
.stacktrace-details {
125133
max-height: 300px;
126134
overflow-y: auto;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ case class Aggregator[K, V, C] (
6161
// Update task metrics if context is not null
6262
// TODO: Make context non optional in a future release
6363
Option(context).foreach { c =>
64-
c.taskMetrics.memoryBytesSpilled += combiners.memoryBytesSpilled
65-
c.taskMetrics.diskBytesSpilled += combiners.diskBytesSpilled
64+
c.taskMetrics.incMemoryBytesSpilled(combiners.memoryBytesSpilled)
65+
c.taskMetrics.incDiskBytesSpilled(combiners.diskBytesSpilled)
6666
}
6767
combiners.iterator
6868
}
@@ -95,8 +95,8 @@ case class Aggregator[K, V, C] (
9595
// Update task metrics if context is not null
9696
// TODO: Make context non-optional in a future release
9797
Option(context).foreach { c =>
98-
c.taskMetrics.memoryBytesSpilled += combiners.memoryBytesSpilled
99-
c.taskMetrics.diskBytesSpilled += combiners.diskBytesSpilled
98+
c.taskMetrics.incMemoryBytesSpilled(combiners.memoryBytesSpilled)
99+
c.taskMetrics.incDiskBytesSpilled(combiners.diskBytesSpilled)
100100
}
101101
combiners.iterator
102102
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private[spark] class ExecutorAllocationManager(
158158
"shuffle service. You may enable this through spark.shuffle.service.enabled.")
159159
}
160160
if (tasksPerExecutor == 0) {
161-
throw new SparkException("spark.executor.cores must not be less than spark.task.cpus.cores")
161+
throw new SparkException("spark.executor.cores must not be less than spark.task.cpus.")
162162
}
163163
}
164164

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.spark
1919

2020
import scala.collection.JavaConverters._
21+
import scala.collection.concurrent.TrieMap
2122
import scala.collection.mutable.{HashMap, LinkedHashSet}
2223
import org.apache.spark.serializer.KryoSerializer
2324

@@ -46,7 +47,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
4647
/** Create a SparkConf that loads defaults from system properties and the classpath */
4748
def this() = this(true)
4849

49-
private[spark] val settings = new HashMap[String, String]()
50+
private[spark] val settings = new TrieMap[String, String]()
5051

5152
if (loadDefaults) {
5253
// Load any spark.* system properties
@@ -177,7 +178,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
177178
}
178179

179180
/** Get all parameters as a list of pairs */
180-
def getAll: Array[(String, String)] = settings.clone().toArray
181+
def getAll: Array[(String, String)] = settings.toArray
181182

182183
/** Get a parameter as an integer, falling back to a default if not set */
183184
def getInt(key: String, defaultValue: Int): Int = {

core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ import org.apache.spark.rdd.RDD
3838
import org.apache.spark.storage.StorageLevel
3939
import org.apache.spark.util.Utils
4040

41+
/**
42+
* Defines operations common to several Java RDD implementations.
43+
* Note that this trait is not intended to be implemented by user code.
44+
*/
4145
trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
4246
def wrapRDD(rdd: RDD[T]): This
4347

@@ -435,6 +439,12 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
435439
*/
436440
def first(): T = rdd.first()
437441

442+
/**
443+
* @return true if and only if the RDD contains no elements at all. Note that an RDD
444+
* may be empty even when it has at least 1 partition.
445+
*/
446+
def isEmpty(): Boolean = rdd.isEmpty()
447+
438448
/**
439449
* Save this RDD as a text file, using string representations of elements.
440450
*/

core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ private[spark] class PythonRDD(
125125
init, finish))
126126
val memoryBytesSpilled = stream.readLong()
127127
val diskBytesSpilled = stream.readLong()
128-
context.taskMetrics.memoryBytesSpilled += memoryBytesSpilled
129-
context.taskMetrics.diskBytesSpilled += diskBytesSpilled
128+
context.taskMetrics.incMemoryBytesSpilled(memoryBytesSpilled)
129+
context.taskMetrics.incDiskBytesSpilled(diskBytesSpilled)
130130
read()
131131
case SpecialLengths.PYTHON_EXCEPTION_THROWN =>
132132
// Signals that an exception has been thrown in python

0 commit comments

Comments
 (0)