concept operation in category spark

appears as: operations, operations, operation, The operations, n operation, The operation, operation
Spark in Action, Second Edition

This is an excerpt from Manning's book Spark in Action, Second Edition.

Spark is lazy: it will work only when asked. Spark will stack up all your requests, and when it needs to, it will optimize the operations and do the hard work. You will look more closely at its laziness in chapter 4. And, like Seth, when you ask nicely, Spark will work very hard.

In one of my projects, the team needed and developed a join between two dataframes that resulted in the second dataframe being a nested document, as a column of the first dataframe. When we needed to add a third dataframe, the team considered developing a method that would take three dataframes, a master and two subdocuments, and so on. Because the operation was fairly heavy, the team wanted to optimize the number of steps. Rather than developing a method to take three dataframes as parameters, the team used the first method several times: each step was simply added to the DAG. At the end, Catalyst took the liberty of optimizing, making the code “lighter” and more readable (and cheaper to maintain).

Figure 16.6 Representation of the number of operations Spark has to do to run all the analytics experiments in this lab. Each square represents an operation. You can quickly see the benefits of caching and/or checkpointing in this context.