GitHub user zero323 opened a pull request:
https://github.com/apache/spark/pull/15144
[SPARK-17587][PYTHON][MLLIB] SparseVector __getitem__ should follow
__getitem__ contract
## What changes were proposed in this pull request?
Replaces ValueError with IndexError when index passed to `ml` / `mllib`
`SparseVector.__getitem__` is out of range. This ensures correct iteration
behavior.
## How was this patch tested?
PySpark `ml` / `mllib` unit tests. Additional unit tests to prove that the
problem has been resolved.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zero323/spark SPARK-17587
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/15144.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #15144
----
commit 250560811497be5f3de5f6165350940dbf8e54c1
Author: zero323 <[email protected]>
Date: 2016-09-18T19:15:14Z
Replace ValueError with IndexError in mllib.linalg
commit 13d39400072d37f3b9ae9596b59ef4d6d579234b
Author: zero323 <[email protected]>
Date: 2016-09-18T19:19:07Z
Replace ValueError with IndexError in ml.linalg
commit aa10114f0ee515485d3f0d0ed9430fbd19349974
Author: zero323 <[email protected]>
Date: 2016-09-18T19:58:14Z
Add tests for ml.linalg.SparseVector iteration
commit 4b90ee591a4e914b8b156927e718d0e088ddce05
Author: zero323 <[email protected]>
Date: 2016-09-18T20:00:13Z
Add tests for mllib.linalg.SparseVector iteration
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]