User1, 1001:2 | 1011:1
User1, 1001:1 | 1011:1
User2, 1001:1011:1 | 1 | 1012:2
User3, 1002:0
The first column is the user name, the second column is the function of the user to open, use | space, there are in the same field, now I want to ask each user's various functions on the number of open and the results are as follows:
User1, 1001:2 1
User1, 1011:1 2
.
Consult everybody, using scala how to do?
CodePudding user response:
The flatMap reduceByKey is ok, is very simple