File tree 1 file changed +6
-2
lines changed
src/main/java/com/sparkTutorial/advanced/accumulator
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ public static void main(String[] args) throws Exception {
30
30
31
31
JavaRDD <String > responseFromCanada = responseRDD .filter (response -> {
32
32
33
+ // update processedBytes accumulator with the size of the current response
33
34
processedBytes .add (response .getBytes ().length );
34
-
35
+
36
+ // split the reponse using commas.
35
37
String [] splits = response .split (Utils .COMMA_DELIMITER , -1 );
36
38
39
+ // increase the total accumulator by 1
37
40
total .add (1 );
38
41
42
+ // increase the missingSalaryMidPoint accumulator by 1 if the salary middle point is not present in the reponse
39
43
if (splits [14 ].isEmpty ()) {
40
44
missingSalaryMidPoint .add (1 );
41
45
}
42
-
46
+ // return true if the reponse is from Canada
43
47
return splits [2 ].equals ("Canada" );
44
48
45
49
});
You can’t perform that action at this time.
0 commit comments