spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Owen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-26638) Pyspark vector classes always return error for unary negation
Date Wed, 06 Feb 2019 16:53:00 GMT

     [ https://issues.apache.org/jira/browse/SPARK-26638?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sean Owen updated SPARK-26638:
------------------------------
    Fix Version/s:     (was: 2.3.4)
                   2.3.3

> Pyspark vector classes always return error for unary negation
> -------------------------------------------------------------
>
>                 Key: SPARK-26638
>                 URL: https://issues.apache.org/jira/browse/SPARK-26638
>             Project: Spark
>          Issue Type: Bug
>          Components: ML, PySpark
>    Affects Versions: 2.3.2, 2.4.0
>            Reporter: Sean Owen
>            Assignee: Sean Owen
>            Priority: Major
>             Fix For: 2.3.3, 2.4.1, 3.0.0
>
>
> It looks like the implementation of {{__neg__}} for Pyspark vector classes is wrong:
> {code}
>     def _delegate(op):
>         def func(self, other):
>             if isinstance(other, DenseVector):
>                 other = other.array
>             return DenseVector(getattr(self.array, op)(other))
>         return func
>     __neg__ = _delegate("__neg__")
> {code}
> This delegation works for binary operators but not for unary, and indeed, it doesn't
work at all:
> {code}
> from pyspark.ml.linalg import DenseVector
> v = DenseVector([1,2,3])
> -v
> ...
> TypeError: func() missing 1 required positional argument: 'other'
> {code}
> This was spotted by static analyis on lgtm.com:
> https://lgtm.com/projects/g/apache/spark/alerts/?mode=tree&lang=python&ruleFocus=7850093
> Easy to fix and add a test for, as I presume we want this to be implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message