@@ -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 /**
0 commit comments