nchammas commented on a change in pull request #34671:
URL: https://github.com/apache/spark/pull/34671#discussion_r754533879



##########
File path: python/pyspark/ml/common.py
##########
@@ -53,24 +57,24 @@ def _new_smart_decode(obj):
 
 
 # this will call the ML version of pythonToJava()
-def _to_java_object_rdd(rdd):
+def _to_java_object_rdd(rdd: RDD) -> JavaObject:
     """Return an JavaRDD of Object by unpickling
 
     It will convert each Python object into Java object by Pickle, whenever the
     RDD is serialized in batch or not.
     """
-    rdd = rdd._reserialize(AutoBatchedSerializer(PickleSerializer()))
-    return 
rdd.ctx._jvm.org.apache.spark.ml.python.MLSerDe.pythonToJava(rdd._jrdd, True)
+    rdd = rdd._reserialize(AutoBatchedSerializer(PickleSerializer()))  # type: 
ignore[attr-defined]
+    return 
rdd.ctx._jvm.org.apache.spark.ml.python.MLSerDe.pythonToJava(rdd._jrdd, True)  
# type: ignore[attr-defined]

Review comment:
       I don't get exactly why mypy doesn't recognize `_reserialize` and `_jvm` 
as attributes. In the case of `_reserialize`, is it the leading underscore 
making it a "private" method? In the case of `_jvm`, is it that it's a class 
attribute?

##########
File path: python/pyspark/ml/_typing.pyi
##########
@@ -64,7 +65,7 @@ MultilabelClassificationEvaluatorMetricType = Union[
     Literal["microRecall"],
     Literal["microF1Measure"],
 ]
-ClusteringEvaluatorMetricType = Union[Literal["silhouette"]]
+ClusteringEvaluatorMetricType = Literal["silhouette"]

Review comment:
       Not sure what the `Union` here was for.




-- 
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