Got below code from http://spark.apache.org. I am getting below error....
Code:
JavaRDD<String> lines = sc.textFile(logFile);
JavaPairRDD<String, Integer> pairs = lines.mapToPair(s -> new Tuple2(s, 1));
Error :
lambda expressions are not supported in -source 1.5 (use -source 8 or higher to enable lambda expressions)
but below code works perfectly fine. Can you please help me to find the reason?
New Code:
JavaRDD<String> lines = sc.textFile(logFile);
JavaPairRDD<String, String> prodPairs = lines.mapToPair(new PairFunction<String, String, String>() {
public Tuple2<String, String> call(String s) {
String[] prodSplit = s.split(",");
return new Tuple2<String, String>(prodSplit[2], prodSplit[0]+","+prodSplit[1]+","+prodSplit[2]);
}
});