I'm relatively new to Scala Spark. I've got a question with map method.
My understanding: map is a RDD method, it accepts a function as its parameter like:map(line => line.split(","))
I found really hard to understand this kind of expression.
val uniqueUsers = data.map { case (user, product, price) => user }.distinct().count()
Could someone explain two things for me:
- why {} is used not ()
- can I regard
case (user, product, price) => useras a function? If not, what is it?
Thank you in advance.