File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/main/java/com/sparkTutorial/advanced/accumulator Expand file tree Collapse file tree 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 {
3030
3131 JavaRDD <String > responseFromCanada = responseRDD .filter (response -> {
3232
33+ // update processedBytes accumulator with the size of the current response
3334 processedBytes .add (response .getBytes ().length );
34-
35+
36+ // split the reponse using commas.
3537 String [] splits = response .split (Utils .COMMA_DELIMITER , -1 );
3638
39+ // increase the total accumulator by 1
3740 total .add (1 );
3841
42+ // increase the missingSalaryMidPoint accumulator by 1 if the salary middle point is not present in the reponse
3943 if (splits [14 ].isEmpty ()) {
4044 missingSalaryMidPoint .add (1 );
4145 }
42-
46+ // return true if the reponse is from Canada
4347 return splits [2 ].equals ("Canada" );
4448
4549 });
You can’t perform that action at this time.
0 commit comments