Advertisement
Guest User

Untitled

a guest
Apr 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.51 KB | None | 0 0
  1. object SimpleApp {
  2. }  def main(args: Array[String]) {
  3.     val logFile = "C:\\Users\\GosiaGosia\\Desktop\\nowy.txt" // Should be some file on your system
  4.     val conf = new SparkConf().setAppName("Simple Application").setMaster("local[*]")
  5.     val sc = new SparkContext(conf)
  6.     val logData = sc.textFile(logFile, 2).cache()
  7.     val numAs = logData.filter(line => line.contains("a")).count()
  8.     val numBs = logData.filter(line => line.contains("b")).count()
  9.     println(s"Lines with a: $numAs, Lines with b: $numBs")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement