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

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.2, 2.2.0
    • Component/s: ML, MLlib
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: