Skip to content

Commit c581dce

Browse files
committed
Changes after building against Shark.
1 parent 8452309 commit c581dce

File tree

8 files changed

+32
-16
lines changed

8 files changed

+32
-16
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import org.apache.hadoop.conf.Configuration
2323
import org.apache.hadoop.io.ObjectWritable
2424
import org.apache.hadoop.io.Writable
2525

26-
private[spark] class SerializableWritable[T <: Writable](@transient var t: T) extends Serializable {
26+
/** <span class="badge" style="float: right; background-color: #44751E;">DEVELOPER API</span> */
27+
class SerializableWritable[T <: Writable](@transient var t: T) extends Serializable {
2728
def value = t
2829
override def toString = t.toString
2930

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

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,28 @@ import org.apache.spark.util.{ClosureCleaner, MetadataCleaner, MetadataCleanerTy
5353
*
5454
* @param config a Spark Config object describing the application configuration. Any settings in
5555
* this config overrides the default configs as well as system properties.
56-
* @param preferredNodeLocationData used in YARN mode to select nodes to launch containers on. Can
57-
* be generated using [[org.apache.spark.scheduler.InputFormatInfo.computePreferredLocations]]
58-
* from a list of input files or InputFormats for the application.
5956
*/
60-
class SparkContext(
61-
config: SparkConf,
62-
// This is used only by YARN for now, but should be relevant to other cluster types (Mesos,
63-
// etc) too. This is typically generated from InputFormatInfo.computePreferredLocations. It
64-
// contains a map from hostname to a list of input format splits on the host.
65-
val preferredNodeLocationData: Map[String, Set[SplitInfo]] = Map())
57+
class SparkContext(config: SparkConf)
6658
extends Logging {
6759

60+
// This is used only by YARN for now, but should be relevant to other cluster types (Mesos,
61+
// etc) too. This is typically generated from InputFormatInfo.computePreferredLocations. It
62+
// contains a map from hostname to a list of input format splits on the host.
63+
private[spark] var preferredNodeLocationData: Map[String, Set[SplitInfo]] = Map()
64+
65+
/**
66+
* <span class="badge" style="float: right; background-color: #44751E;">DEVELOPER API</span>
67+
* Alternative constructor for setting preferred locations where Spark will create executors.
68+
*
69+
* @param preferredNodeLocationData used in YARN mode to select nodes to launch containers on. Can
70+
* be generated using [[org.apache.spark.scheduler.InputFormatInfo.computePreferredLocations]]
71+
* from a list of input files or InputFormats for the application.
72+
*/
73+
def this(config: SparkConf, preferredNodeLocationData: Map[String, Set[SplitInfo]]) = {
74+
this(config)
75+
this.preferredNodeLocationData = preferredNodeLocationData
76+
}
77+
6878
/**
6979
* Alternative constructor that allows setting common Spark properties directly
7080
*
@@ -606,6 +616,9 @@ class SparkContext(
606616
def union[T: ClassTag](first: RDD[T], rest: RDD[T]*): RDD[T] =
607617
new UnionRDD(this, Seq(first) ++ rest)
608618

619+
/** Get an RDD that has no partitions or elements. */
620+
def emptyRDD[T: ClassTag] = new EmptyRDD[T](this)
621+
609622
// Methods for creating shared variables
610623

611624
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ import org.apache.spark.storage._
3535
import org.apache.spark.util.{AkkaUtils, Utils}
3636

3737
/**
38+
* <span class="badge" style="float: right; background-color: #44751E;">DEVELOPER API</span>
3839
* Holds all the runtime environment objects for a running Spark instance (either master or worker),
3940
* including the serializer, Akka actor system, block manager, map output tracker, etc. Currently
4041
* Spark code finds the SparkEnv through a thread-local variable, so each thread that accesses these
4142
* objects needs to have the right SparkEnv set. You can get the current environment with
4243
* SparkEnv.get (e.g. after creating a SparkContext) and set it with SparkEnv.set.
4344
*/
44-
private[spark] class SparkEnv (
45+
class SparkEnv (
4546
val executorId: String,
4647
val actorSystem: ActorSystem,
4748
val serializer: Serializer,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import scala.reflect.ClassTag
2222
import org.apache.spark.{Partition, SparkContext, TaskContext}
2323

2424
/**
25-
* An RDD that has no partitions and no elements..
25+
* An RDD that has no partitions and no elements.
2626
*/
27-
private[spark] class EmptyRDD[T: ClassTag](sc: SparkContext) extends RDD[T](sc, Nil) {
27+
class EmptyRDD[T: ClassTag](sc: SparkContext) extends RDD[T](sc, Nil) {
2828

2929
override def getPartitions: Array[Partition] = Array.empty
3030

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private[spark] class UnionPartition[T: ClassTag](idx: Int, rdd: RDD[T], splitInd
4343
}
4444
}
4545

46-
private[spark] class UnionRDD[T: ClassTag](
46+
class UnionRDD[T: ClassTag](
4747
sc: SparkContext,
4848
@transient var rdds: Seq[RDD[T]])
4949
extends RDD[T](sc, Nil) { // Nil since we implement getDependencies

core/src/main/scala/org/apache/spark/scheduler/InputFormatInfo.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import org.apache.spark.Logging
3030
import org.apache.spark.deploy.SparkHadoopUtil
3131

3232
/**
33+
* <span class="badge" style="float: right; background-color: #44751E;">DEVELOPER API</span>
3334
* Parses and holds information about inputFormat (and files) specified as a parameter.
3435
*/
3536
class InputFormatInfo(val configuration: Configuration, val inputFormatClazz: Class[_],

core/src/main/scala/org/apache/spark/scheduler/SplitInfo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import collection.mutable.ArrayBuffer
2121

2222
// information about a specific split instance : handles both split instances.
2323
// So that we do not need to worry about the differences.
24-
private[spark]
24+
/** <span class="badge" style="float: right; background-color: #44751E;">DEVELOPER API</span> */
2525
class SplitInfo(val inputFormatClazz: Class[_], val hostLocation: String, val path: String,
2626
val length: Long, val underlyingSplit: Any) {
2727
override def toString(): String = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import scala.util.Random
2121

2222
import org.apache.spark.util.random.XORShiftRandom
2323

24-
@deprecated("Use Vector from Spark's mllib.linalg package instead.", "1.0.0")
24+
@deprecated("Use Vectors.dense from Spark's mllib.linalg package instead.", "1.0.0")
2525
class Vector(val elements: Array[Double]) extends Serializable {
2626
def length = elements.length
2727

0 commit comments

Comments
 (0)