Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-20615

SparseVector.argmax throws IndexOutOfBoundsException when the sparse vector has a size greater than zero but no elements defined.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.1.0
    • 2.1.2, 2.2.0
    • ML, MLlib
    • None

    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.

      Attachments

        Activity

          People

            mclean Jon McLean
            mclean Jon McLean
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: