Skip to content

Commit bcb3db2

Browse files
authoredMar 12, 2018
Update StackOverFlowSurveyFollowUp.java
1 parent f3f4fe0 commit bcb3db2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎src/main/java/com/sparkTutorial/advanced/accumulator/StackOverFlowSurveyFollowUp.java

+6-2
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)
Please sign in to comment.