How to interpret upper-triangular matrix of cosine similarities
Solution is to transform the matrix:

JavaRDD&lt;Vector&gt; rows = jsc.parallelize(Arrays.asList(
    new DenseVector(new double[]{2, 2}),
    new DenseVector(new double[]{0, 1}),
    new DenseVector(new double[]{1, 1}),
    new DenseVector(new double[]{1, 0}),
    new DenseVector(new double[]{0, 1}),
    new DenseVector(new double[]{2, 1}),
    new DenseVector(new double[]{1, 1}),
    new DenseVector(new double[]{1, 1})
));
​
RowMatrix mat = new RowMatrix(rows.rdd());
List&lt;Vector&gt; sims = mat.columnSimilarities().toRowMatrix().rows().toJavaRDD().collect();
for(Vector v: sims) {
  System.out.println(v); //(2,[1],[0.8215838362577492])
}