Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object SimpleApp {
- } def main(args: Array[String]) {
- val logFile = "C:\\Users\\GosiaGosia\\Desktop\\nowy.txt" // Should be some file on your system
- val conf = new SparkConf().setAppName("Simple Application").setMaster("local[*]")
- val sc = new SparkContext(conf)
- val logData = sc.textFile(logFile, 2).cache()
- val numAs = logData.filter(line => line.contains("a")).count()
- val numBs = logData.filter(line => line.contains("b")).count()
- println(s"Lines with a: $numAs, Lines with b: $numBs")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement