title: reduceByKey is not a member
body: <p>Hi I have code simply get word counts from a document. I also need to use a map to look up the data value before generating the output. Here is the code.  </p>
  
  <pre><code>   requests
      .filter(_.description.exists(_.length &gt; 0))
      .flatMap { case request =&gt;
        broadcastDataMap.value.get(request.requestId).map {
          data =&gt;
            val text = Seq(
              data.name,
              data.taxonym,
              data.pluralTaxonym,
              request.description.get
            ).mkString(" ")
            getWordCountsInDocument(text).map { case (word, count) =&gt;
              (word, Map(request.requestId -&gt; count))
            }
        }
      }
      .reduceByKey(mergeMap)
  </code></pre>
  
  <p>The error message is </p>
  
  <pre><code>reduceByKey is not a member of org.apache.spark.rdd.RDD[scala.collection.immutable.Map[String,scala.collection.immutable.Map[Int,Int]]]
  </code></pre>
  
  <p>How can I resolve this? I do need to call getWordCountsInDocument. Thanks!</p>