package de.hsma.informatik.bdea;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

public class LineCount {

	public static void main(String[] args) {
		String pfad = "src/main/resources/Faust.txt";
		
		SparkConf conf = new SparkConf()
				.setAppName("LineCount").setMaster("local[*]");
		JavaSparkContext sc = new JavaSparkContext(conf);
		
		JavaRDD<String> text = sc.textFile(pfad);
		long cnt = text.filter(line -> line.contains("Liebe")).count();
		
		System.out.println(cnt + " Zeilen mit 'Liebe' in " + pfad);
		sc.close();
	}

}
