This part of the article series delves into using map to transform an object contained in an Option and how to chain optional values together using flatMap.
From Spark in Action, Second Edition by Jean-Georges Perrin
This article teaches you how to perform an aggregation using Apache Spark. You first look at the definition of an aggregation. You may already know and use aggregations in your job, and this might be a reminder for you. If this is the case, you can safely skim through it: Apache Spark’s aggregations are standard. The second part of this section shows you how to transform a SQL aggregation statement to Spark.