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

__gettitem__ method throws IndexError exception when we try to access index after the last non-zero entry.

    XMLWordPrintableJSON

Details

    Description

      __gettitem__ method throws IndexError exception when we try to access index after the last non-zero entry.

      from pyspark.mllib.linalg import Vectors
      sv = Vectors.sparse(5, {1: 3})
      sv[0]
      ## 0.0
      sv[1]
      ## 3.0
      sv[2]
      ## Traceback (most recent call last):
      ##   File "<stdin>", line 1, in <module>
      ##   File "/python/pyspark/mllib/linalg/__init__.py", line 734, in __getitem__
      ##     row_ind = inds[insert_index]
      ## IndexError: index out of bounds
      

      Attachments

        Activity

          People

            zero323 Maciej Szymkiewicz
            zero323 Maciej Szymkiewicz
            Joseph K. Bradley Joseph K. Bradley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: