Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/9069#discussion_r41779732
--- Diff: python/pyspark/mllib/linalg/__init__.py ---
@@ -764,10 +764,12 @@ def __getitem__(self, index):
if not isinstance(index, int):
raise TypeError(
"Indices must be of type integer, got type %s" %
type(index))
+
+ original_index = index
if index < 0:
index += self.size
if index >= self.size or index < 0:
- raise ValueError("Index %d out of bounds." % index)
+ raise ValueError("Index %d out of bounds." % original_index)
--- End diff --
It might be better to move this check to line 768, before index gets
modified. That way, you don't have to even create a copy of index (though
you'll need to adjust the check's index range).
---
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]