How it works...

The index is a long data structure which provides a meaningful row index corresponding to each row of the IndexedRowMatrix. The horsepower underneath the implementation are the RDDs which offer all the advantages of a distributed resilient data structure in a parallel environment from the get go.

The primary advantage of IndexedRowMatrix is that the index can be carried along with the row (RDD) which is the data itself. The fact that we can define and carry along the index with the data (the actual row of matrix) is very useful when we have the join() operation that needs a key to select a specific row of data.

The following figure shows a pictorial view of the IndexedRowMatrix which should help clarify the subject:

The definition ...

Get Apache Spark 2.x Machine Learning Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.