You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/03/14 10:03:35 UTC

[GitHub] [spark] dchvn commented on a change in pull request #35530: [SPARK-37405][PYTHON] Inline type hints for python/pyspark/ml/feature.py

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



##########
File path: python/pyspark/ml/feature.py
##########
@@ -392,24 +465,29 @@ class _BucketedRandomProjectionLSHParams:
     .. versionadded:: 3.0.0
     """
 
-    bucketLength = Param(
+    bucketLength: Param[float] = Param(
         Params._dummy(),
         "bucketLength",
         "the length of each hash bucket, " + "a larger bucket lowers the false negative rate.",
         typeConverter=TypeConverters.toFloat,
     )
 
     @since("2.2.0")
-    def getBucketLength(self):
+    def getBucketLength(self) -> float:
         """
         Gets the value of bucketLength or its default value.
         """
-        return self.getOrDefault(self.bucketLength)
+        return self.getOrDefault(self.bucketLength)  # type: ignore[attr-defined]

Review comment:
       After checking with mypy: `python/pyspark/ml/feature.py:480: error: "_BucketedRandomProjectionLSHParams" has no attribute "getOrDefault"  [attr-defined]`




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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