Demo entry 6659033

scala

   

Submitted by iss on Nov 08, 2017 at 16:25
Language: Scala. Code size: 291 Bytes.

  def wordcount(): RDD[(String, Int)] = {

    loadData().map{word => (word , 1)}.reduceByKey{case(x,y) => x+y }

  }

  /**
   *  Now keep the word which appear strictly more than 4 times!
   */
  def filterOnWordcount(): RDD[(String, Int)] = {
    wordcount().filter(_._2>4)
  }

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).