In this section, we'll be looking at the actions on key/value pairs.
We will cover the following topics:
- Examining actions on key/value pairs
- Using collect()
- Examining the output for the key/value RDD
In the first section of this chapter, we covered transformations that are available on key/value pairs. We saw that they are a bit different compared to RDDs. Also, for actions, it is slightly different in terms of result but not in the method name.
Therefore, we'll be using collect() and we'll be examining the output of our action on these key/value pairs.
First, we will create our transactions array and RDD according to userId, as shown in the following example:
val keysWithValuesList =
Array(
UserTransaction("A", 100),
UserTransaction("B", 4),
UserTransaction("A", 100001),
UserTransaction("B"...