Description
org.apache.spark.ml.linalg.SparseVector.argmax throws an IndexOutOfRangeException when the vector size is greater than zero and no values are defined. The toString() representation of such a vector is " (100000,[],[])". This is because the argmax function tries to get the value at indexes(0) without checking the size of the array.
Code inspection reveals that the mllib version of SparseVector should have the same issue.