title: value reduceByKey is not a member of org.apache.spark.rdd.RDD
body: <p>It's very sad.My spark version is 2.1.1,Scala version is 2.11</p>
  
  <pre><code>import org.apache.spark.SparkContext._
  import com.mufu.wcsa.component.dimension.{DimensionKey, KeyTrait}
  import com.mufu.wcsa.log.LogRecord
  import org.apache.spark.rdd.RDD
  
  object PV {
  
  //
    def stat[C &lt;: LogRecord,K &lt;:DimensionKey](statTrait: KeyTrait[C ,K],logRecords: RDD[C]): RDD[(K,Int)] = {
      val t = logRecords.map(record =&gt;(statTrait.getKey(record),1)).reduceByKey((x,y) =&gt; x + y)
  </code></pre>
  
  <p>I got this error</p>
  
  <pre><code>at 1502387780429
  [ERROR] /Users/lemanli/work/project/newcma/wcsa/wcsa_my/wcsavistor/src/main/scala/com/mufu/wcsa/component/stat/PV.scala:25: error: value reduceByKey is not a member of org.apache.spark.rdd.RDD[(K, Int)]
  [ERROR]     val t = logRecords.map(record =&gt;(statTrait.getKey(record),1)).reduceByKey((x,y) =&gt; x + y)
  </code></pre>
  
  <p>there is defined a trait</p>
  
  <pre><code>trait KeyTrait[C &lt;: LogRecord,K &lt;: DimensionKey]{
    def getKey(c:C):K
  }
  </code></pre>
  
  <blockquote>
    <p>It is compiled,Thanks.</p>
  </blockquote>
  
  <pre><code> def stat[C &lt;: LogRecord,K &lt;:DimensionKey : ClassTag : Ordering](statTrait: KeyTrait[C ,K],logRecords: RDD[C]): RDD[(K,Int)] = {
      val t = logRecords.map(record =&gt;(statTrait.getKey(record),1)).reduceByKey((x,y) =&gt; x + y)
  </code></pre>
  
  <p>Key need to override Ordering[T].</p>
  
  <pre><code>  object ClientStat extends KeyTrait[DetailLogRecord, ClientStat] {
        implicit val c
  
  lientStatSorting = new Ordering[ClientStat] {
      override def compare(x: ClientStat, y: ClientStat): Int = x.key.compare(y.key)
    }
  
        def getKey(detailLogRecord: DetailLogRecord): ClientStat = new ClientStat(detailLogRecord)
      }
  </code></pre>