Skip to content

Commit 3e986f8

Browse files
committed
Merge remote-tracking branch 'apache/master' into streaming-web-ui
Conflicts: streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala streaming/src/main/scala/org/apache/spark/streaming/dstream/NetworkInputDStream.scala streaming/src/main/scala/org/apache/spark/streaming/scheduler/JobGenerator.scala streaming/src/main/scala/org/apache/spark/streaming/scheduler/JobScheduler.scala streaming/src/main/scala/org/apache/spark/streaming/scheduler/NetworkInputTracker.scala
2 parents 61358e3 + bde9cc1 commit 3e986f8

File tree

485 files changed

+11230
-3658
lines changed

Some content is hidden

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

485 files changed

+11230
-3658
lines changed

.rat-excludes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ work
3939
.*\.q
4040
golden
4141
test.out/*
42+
.*iml

assembly/pom.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@
163163
</dependency>
164164
</dependencies>
165165
</profile>
166+
<profile>
167+
<id>hive</id>
168+
<dependencies>
169+
<dependency>
170+
<groupId>org.apache.spark</groupId>
171+
<artifactId>spark-hive_${scala.binary.version}</artifactId>
172+
<version>${project.version}</version>
173+
</dependency>
174+
</dependencies>
175+
</profile>
166176
<profile>
167177
<id>spark-ganglia-lgpl</id>
168178
<dependencies>
@@ -208,7 +218,7 @@
208218
<plugin>
209219
<groupId>org.codehaus.mojo</groupId>
210220
<artifactId>buildnumber-maven-plugin</artifactId>
211-
<version>1.1</version>
221+
<version>1.2</version>
212222
<executions>
213223
<execution>
214224
<phase>validate</phase>

bagel/src/main/scala/org/apache/spark/bagel/Bagel.scala

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,27 +220,31 @@ object Bagel extends Logging {
220220
*/
221221
private def comp[K: Manifest, V <: Vertex, M <: Message[K], C](
222222
sc: SparkContext,
223-
grouped: RDD[(K, (Seq[C], Seq[V]))],
223+
grouped: RDD[(K, (Iterable[C], Iterable[V]))],
224224
compute: (V, Option[C]) => (V, Array[M]),
225225
storageLevel: StorageLevel
226226
): (RDD[(K, (V, Array[M]))], Int, Int) = {
227227
var numMsgs = sc.accumulator(0)
228228
var numActiveVerts = sc.accumulator(0)
229-
val processed = grouped.flatMapValues {
230-
case (_, vs) if vs.size == 0 => None
231-
case (c, vs) =>
229+
val processed = grouped.mapValues(x => (x._1.iterator, x._2.iterator))
230+
.flatMapValues {
231+
case (_, vs) if !vs.hasNext => None
232+
case (c, vs) => {
232233
val (newVert, newMsgs) =
233-
compute(vs(0), c match {
234-
case Seq(comb) => Some(comb)
235-
case Seq() => None
236-
})
234+
compute(vs.next,
235+
c.hasNext match {
236+
case true => Some(c.next)
237+
case false => None
238+
}
239+
)
237240

238241
numMsgs += newMsgs.size
239242
if (newVert.active) {
240243
numActiveVerts += 1
241244
}
242245

243246
Some((newVert, newMsgs))
247+
}
244248
}.persist(storageLevel)
245249

246250
// Force evaluation of processed RDD for accurate performance measurements

bin/compute-classpath.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,7 @@ FWDIR="$(cd `dirname $0`/..; pwd)"
3030
# Build up classpath
3131
CLASSPATH="$SPARK_CLASSPATH:$FWDIR/conf"
3232

33-
# Support for interacting with Hive. Since hive pulls in a lot of dependencies that might break
34-
# existing Spark applications, it is not included in the standard spark assembly. Instead, we only
35-
# include it in the classpath if the user has explicitly requested it by running "sbt hive/assembly"
36-
# Hopefully we will find a way to avoid uber-jars entirely and deploy only the needed packages in
37-
# the future.
38-
if [ -f "$FWDIR"/sql/hive/target/scala-$SCALA_VERSION/spark-hive-assembly-*.jar ]; then
39-
40-
# Datanucleus jars do not work if only included in the uberjar as plugin.xml metadata is lost.
41-
DATANUCLEUSJARS=$(JARS=("$FWDIR/lib_managed/jars"/datanucleus-*.jar); IFS=:; echo "${JARS[*]}")
42-
CLASSPATH=$CLASSPATH:$DATANUCLEUSJARS
43-
44-
ASSEMBLY_DIR="$FWDIR/sql/hive/target/scala-$SCALA_VERSION/"
45-
else
46-
ASSEMBLY_DIR="$FWDIR/assembly/target/scala-$SCALA_VERSION/"
47-
fi
33+
ASSEMBLY_DIR="$FWDIR/assembly/target/scala-$SCALA_VERSION"
4834

4935
# First check if we have a dependencies jar. If so, include binary classes with the deps jar
5036
if [ -f "$ASSEMBLY_DIR"/spark-assembly*hadoop*-deps.jar ]; then
@@ -59,7 +45,7 @@ if [ -f "$ASSEMBLY_DIR"/spark-assembly*hadoop*-deps.jar ]; then
5945
CLASSPATH="$CLASSPATH:$FWDIR/sql/core/target/scala-$SCALA_VERSION/classes"
6046
CLASSPATH="$CLASSPATH:$FWDIR/sql/hive/target/scala-$SCALA_VERSION/classes"
6147

62-
DEPS_ASSEMBLY_JAR=`ls "$ASSEMBLY_DIR"/spark*-assembly*hadoop*-deps.jar`
48+
DEPS_ASSEMBLY_JAR=`ls "$ASSEMBLY_DIR"/spark-assembly*hadoop*-deps.jar`
6349
CLASSPATH="$CLASSPATH:$DEPS_ASSEMBLY_JAR"
6450
else
6551
# Else use spark-assembly jar from either RELEASE or assembly directory
@@ -71,6 +57,23 @@ else
7157
CLASSPATH="$CLASSPATH:$ASSEMBLY_JAR"
7258
fi
7359

60+
# When Hive support is needed, Datanucleus jars must be included on the classpath.
61+
# Datanucleus jars do not work if only included in the uber jar as plugin.xml metadata is lost.
62+
# Both sbt and maven will populate "lib_managed/jars/" with the datanucleus jars when Spark is
63+
# built with Hive, so first check if the datanucleus jars exist, and then ensure the current Spark
64+
# assembly is built for Hive, before actually populating the CLASSPATH with the jars.
65+
# Note that this check order is faster (by up to half a second) in the case where Hive is not used.
66+
num_datanucleus_jars=$(ls "$FWDIR"/lib_managed/jars/ 2>/dev/null | grep "datanucleus-.*\\.jar" | wc -l)
67+
if [ $num_datanucleus_jars -gt 0 ]; then
68+
AN_ASSEMBLY_JAR=${ASSEMBLY_JAR:-$DEPS_ASSEMBLY_JAR}
69+
num_hive_files=$(jar tvf "$AN_ASSEMBLY_JAR" org/apache/hadoop/hive/ql/exec 2>/dev/null | wc -l)
70+
if [ $num_hive_files -gt 0 ]; then
71+
echo "Spark assembly has been built with Hive, including Datanucleus jars on classpath" 1>&2
72+
DATANUCLEUSJARS=$(echo "$FWDIR/lib_managed/jars"/datanucleus-*.jar | tr " " :)
73+
CLASSPATH=$CLASSPATH:$DATANUCLEUSJARS
74+
fi
75+
fi
76+
7477
# Add test classes if we're running from SBT or Maven with SPARK_TESTING set to 1
7578
if [[ $SPARK_TESTING == 1 ]]; then
7679
CLASSPATH="$CLASSPATH:$FWDIR/core/target/scala-$SCALA_VERSION/test-classes"

bin/load-spark-env.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ if [ -z "$SPARK_ENV_LOADED" ]; then
3030
use_conf_dir=${SPARK_CONF_DIR:-"$parent_dir/conf"}
3131

3232
if [ -f "${use_conf_dir}/spark-env.sh" ]; then
33+
# Promote all variable declarations to environment (exported) variables
34+
set -a
3335
. "${use_conf_dir}/spark-env.sh"
36+
set +a
3437
fi
3538
fi

bin/pyspark

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ if [ -n "$IPYTHON_OPTS" ]; then
5555
IPYTHON=1
5656
fi
5757

58-
if [[ "$IPYTHON" = "1" ]] ; then
58+
# Only use ipython if no command line arguments were provided [SPARK-1134]
59+
if [[ "$IPYTHON" = "1" && $# = 0 ]] ; then
5960
exec ipython $IPYTHON_OPTS
6061
else
6162
exec "$PYSPARK_PYTHON" "$@"

bin/spark-class

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,3 @@ if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
154154
fi
155155

156156
exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
157-
158-

bin/spark-shell

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ set -o posix
3434
FWDIR="$(cd `dirname $0`/..; pwd)"
3535

3636
SPARK_REPL_OPTS="${SPARK_REPL_OPTS:-""}"
37-
DEFAULT_MASTER="local"
37+
DEFAULT_MASTER="local[*]"
3838
MASTER=${MASTER:-""}
3939

4040
info_log=0
@@ -64,7 +64,7 @@ ${txtbld}OPTIONS${txtrst}:
6464
is followed by m for megabytes or g for gigabytes, e.g. "1g".
6565
-dm --driver-memory : The memory used by the Spark Shell, the number is followed
6666
by m for megabytes or g for gigabytes, e.g. "1g".
67-
-m --master : A full string that describes the Spark Master, defaults to "local"
67+
-m --master : A full string that describes the Spark Master, defaults to "local[*]"
6868
e.g. "spark://localhost:7077".
6969
--log-conf : Enables logging of the supplied SparkConf as INFO at start of the
7070
Spark Context.
@@ -127,7 +127,7 @@ function set_spark_log_conf(){
127127

128128
function set_spark_master(){
129129
if ! [[ "$1" =~ $ARG_FLAG_PATTERN ]]; then
130-
MASTER="$1"
130+
export MASTER="$1"
131131
else
132132
out_error "wrong format for $2"
133133
fi
@@ -145,7 +145,7 @@ function resolve_spark_master(){
145145
fi
146146

147147
if [ -z "$MASTER" ]; then
148-
MASTER="$DEFAULT_MASTER"
148+
export MASTER="$DEFAULT_MASTER"
149149
fi
150150

151151
}

core/pom.xml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@
8282
<groupId>com.google.guava</groupId>
8383
<artifactId>guava</artifactId>
8484
</dependency>
85+
<dependency>
86+
<groupId>com.google.code.findbugs</groupId>
87+
<artifactId>jsr305</artifactId>
88+
</dependency>
8589
<dependency>
8690
<groupId>org.slf4j</groupId>
8791
<artifactId>slf4j-api</artifactId>
@@ -113,12 +117,10 @@
113117
<dependency>
114118
<groupId>com.twitter</groupId>
115119
<artifactId>chill_${scala.binary.version}</artifactId>
116-
<version>0.3.1</version>
117120
</dependency>
118121
<dependency>
119122
<groupId>com.twitter</groupId>
120123
<artifactId>chill-java</artifactId>
121-
<version>0.3.1</version>
122124
</dependency>
123125
<dependency>
124126
<groupId>commons-net</groupId>
@@ -196,6 +198,53 @@
196198
<artifactId>derby</artifactId>
197199
<scope>test</scope>
198200
</dependency>
201+
<dependency>
202+
<groupId>org.tachyonproject</groupId>
203+
<artifactId>tachyon</artifactId>
204+
<version>0.4.1-thrift</version>
205+
<exclusions>
206+
<exclusion>
207+
<groupId>org.apache.hadoop</groupId>
208+
<artifactId>hadoop-client</artifactId>
209+
</exclusion>
210+
<exclusion>
211+
<groupId>org.apache.curator</groupId>
212+
<artifactId>curator-recipes</artifactId>
213+
</exclusion>
214+
<exclusion>
215+
<groupId>org.eclipse.jetty</groupId>
216+
<artifactId>jetty-jsp</artifactId>
217+
</exclusion>
218+
<exclusion>
219+
<groupId>org.eclipse.jetty</groupId>
220+
<artifactId>jetty-webapp</artifactId>
221+
</exclusion>
222+
<exclusion>
223+
<groupId>org.eclipse.jetty</groupId>
224+
<artifactId>jetty-server</artifactId>
225+
</exclusion>
226+
<exclusion>
227+
<groupId>org.eclipse.jetty</groupId>
228+
<artifactId>jetty-servlet</artifactId>
229+
</exclusion>
230+
<exclusion>
231+
<groupId>junit</groupId>
232+
<artifactId>junit</artifactId>
233+
</exclusion>
234+
<exclusion>
235+
<groupId>org.powermock</groupId>
236+
<artifactId>powermock-module-junit4</artifactId>
237+
</exclusion>
238+
<exclusion>
239+
<groupId>org.powermock</groupId>
240+
<artifactId>powermock-api-mockito</artifactId>
241+
</exclusion>
242+
<exclusion>
243+
<groupId>org.apache.curator</groupId>
244+
<artifactId>curator-test</artifactId>
245+
</exclusion>
246+
</exclusions>
247+
</dependency>
199248
<dependency>
200249
<groupId>org.scalatest</groupId>
201250
<artifactId>scalatest_${scala.binary.version}</artifactId>

core/src/main/java/org/apache/spark/api/java/StorageLevels.java

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@
2323
* Expose some commonly useful storage level constants.
2424
*/
2525
public class StorageLevels {
26-
public static final StorageLevel NONE = create(false, false, false, 1);
27-
public static final StorageLevel DISK_ONLY = create(true, false, false, 1);
28-
public static final StorageLevel DISK_ONLY_2 = create(true, false, false, 2);
29-
public static final StorageLevel MEMORY_ONLY = create(false, true, true, 1);
30-
public static final StorageLevel MEMORY_ONLY_2 = create(false, true, true, 2);
31-
public static final StorageLevel MEMORY_ONLY_SER = create(false, true, false, 1);
32-
public static final StorageLevel MEMORY_ONLY_SER_2 = create(false, true, false, 2);
33-
public static final StorageLevel MEMORY_AND_DISK = create(true, true, true, 1);
34-
public static final StorageLevel MEMORY_AND_DISK_2 = create(true, true, true, 2);
35-
public static final StorageLevel MEMORY_AND_DISK_SER = create(true, true, false, 1);
36-
public static final StorageLevel MEMORY_AND_DISK_SER_2 = create(true, true, false, 2);
26+
public static final StorageLevel NONE = create(false, false, false, false, 1);
27+
public static final StorageLevel DISK_ONLY = create(true, false, false, false, 1);
28+
public static final StorageLevel DISK_ONLY_2 = create(true, false, false, false, 2);
29+
public static final StorageLevel MEMORY_ONLY = create(false, true, false, true, 1);
30+
public static final StorageLevel MEMORY_ONLY_2 = create(false, true, false, true, 2);
31+
public static final StorageLevel MEMORY_ONLY_SER = create(false, true, false, false, 1);
32+
public static final StorageLevel MEMORY_ONLY_SER_2 = create(false, true, false, false, 2);
33+
public static final StorageLevel MEMORY_AND_DISK = create(true, true, false, true, 1);
34+
public static final StorageLevel MEMORY_AND_DISK_2 = create(true, true, false, true, 2);
35+
public static final StorageLevel MEMORY_AND_DISK_SER = create(true, true, false, false, 1);
36+
public static final StorageLevel MEMORY_AND_DISK_SER_2 = create(true, true, false, false, 2);
37+
public static final StorageLevel OFF_HEAP = create(false, false, true, false, 1);
3738

3839
/**
3940
* Create a new StorageLevel object.
@@ -42,7 +43,26 @@ public class StorageLevels {
4243
* @param deserialized saved as deserialized objects, if true
4344
* @param replication replication factor
4445
*/
45-
public static StorageLevel create(boolean useDisk, boolean useMemory, boolean deserialized, int replication) {
46-
return StorageLevel.apply(useDisk, useMemory, deserialized, replication);
46+
@Deprecated
47+
public static StorageLevel create(boolean useDisk, boolean useMemory, boolean deserialized,
48+
int replication) {
49+
return StorageLevel.apply(useDisk, useMemory, false, deserialized, replication);
50+
}
51+
52+
/**
53+
* Create a new StorageLevel object.
54+
* @param useDisk saved to disk, if true
55+
* @param useMemory saved to memory, if true
56+
* @param useOffHeap saved to Tachyon, if true
57+
* @param deserialized saved as deserialized objects, if true
58+
* @param replication replication factor
59+
*/
60+
public static StorageLevel create(
61+
boolean useDisk,
62+
boolean useMemory,
63+
boolean useOffHeap,
64+
boolean deserialized,
65+
int replication) {
66+
return StorageLevel.apply(useDisk, useMemory, useOffHeap, deserialized, replication);
4767
}
4868
}

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

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

1818
package org.apache.spark
1919

20+
import org.apache.spark.annotation.DeveloperApi
2021
import org.apache.spark.util.collection.{AppendOnlyMap, ExternalAppendOnlyMap}
2122

2223
/**
24+
* :: DeveloperApi ::
2325
* A set of functions used to aggregate data.
2426
*
2527
* @param createCombiner function to create the initial value of the aggregation.
2628
* @param mergeValue function to merge a new value into the aggregation result.
2729
* @param mergeCombiners function to merge outputs from multiple mergeValue function.
2830
*/
31+
@DeveloperApi
2932
case class Aggregator[K, V, C] (
3033
createCombiner: V => C,
3134
mergeValue: (C, V) => C,

0 commit comments

Comments
 (0)