dchvn commented on a change in pull request #34513:
URL: https://github.com/apache/spark/pull/34513#discussion_r756528246



##########
File path: python/pyspark/mllib/stat/_statistics.py
##########
@@ -33,34 +39,34 @@ class MultivariateStatisticalSummary(JavaModelWrapper):
     Trait for multivariate statistical summary of a data matrix.
     """
 
-    def mean(self):
-        return self.call("mean").toArray()
+    def mean(self) -> ndarray:
+        return cast(JavaObject, self.call("mean")).toArray()

Review comment:
       a lot of `cast(JavaObject, self.call("..."))` added because `bytearray` 
and `bytes` does not have `toArray`

##########
File path: python/pyspark/mllib/stat/_statistics.py
##########
@@ -168,12 +190,34 @@ def corr(x, y=None, method=None):
             raise TypeError("Use 'method=' to specify method name.")
 
         if not y:
-            return callMLlibFunc("corr", x.map(_convert_to_vector), 
method).toArray()
+            return cast(
+                JavaObject, callMLlibFunc("corr", x.map(_convert_to_vector), 
method)
+            ).toArray()
         else:
-            return callMLlibFunc("corr", x.map(float), y.map(float), method)
+            return cast(

Review comment:
       `callMLlibFunc` return `Union[JavaObject, bytearray, bytes]` but we 
expect `Union[float, Matrix]`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to