error: not found: value in scala command wordcount

788 views Asked by At

I am trying run some scala code in spark following an online video tutorial: it's a wordcount program

val lines = sc.textFile("/data/mr/wordcount/big.txt")
val words = lines.flatMap(x => x.split(" "))
val pairs = words.map(s => (s.toLowerCase(), 1))
val counts = pairs.reduceByKey((a, b) => a + b)
counts.take(10)

enter image description here

<console>:24: error: not found: value counts
   counts.take(10)
   ^

and it's the same error whenever I run ever command that does not start with val

0

There are 0 answers