[英]is RDD[(K, V)] a type in rdd: RDD[(K, V)]?
In spark file of /core/src/main/scala/org/apache/spark/SparkContext.scala, the has the following 在/core/src/main/scala/org/apache/spark/SparkContext.scala的spark文件中,具有以下内容
implicit def rddToPairRDDFunctions[K, V](rdd: RDD[(K, V)])
(implicit kt: ClassTag[K], vt: ClassTag[V], ord: Ordering[K] = null) = {
new PairRDDFunctions(rdd)
}
I think RDD[(K, V)] is a type for paraemter of rdd. 我认为RDD [(K,V)]是rdd参数的类型。 However, how could we define a type like RDD[(K, V)]? 但是,我们如何定义像RDD [(K,V)]这样的类型? The following could NOT be compiled 以下内容无法编译
abstract class RDD[(K, V)]
But the following could. 但是以下可能。
abstract class RDD[K, V]
So what's RDD[(K, V)] 那么什么是RDD [(K,V)]
(K, V)
means Tuple2[K, V]
, so rdd: RDD[(K, V)]
means rdd: RDD[Tuple2[K, V]]
. (K, V)
表示Tuple2[K, V]
,因此rdd: RDD[(K, V)]
表示rdd: RDD[Tuple2[K, V]]
。 Type RDD
should have a single type parameter. RDD
类型应具有单个类型参数。
class RDD[T]
new RDD[(Int, String)] // new RDD[Tuple2[Int, String]]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.