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/09/02 09:39:09 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #37752: [SPARK-40301][PYTHON] Add parameter validations in pyspark.rdd

zhengruifeng commented on code in PR #37752:
URL: https://github.com/apache/spark/pull/37752#discussion_r961493174


##########
python/pyspark/rdd.py:
##########
@@ -1039,7 +1039,8 @@ def sample(
         >>> 6 <= rdd.sample(False, 0.1, 81).count() <= 14
         True
         """
-        assert fraction >= 0.0, "Negative fraction value: %s" % fraction
+        if not fraction >= 0:
+            raise ValueError("Fraction must be nonnegative.")

Review Comment:
   `AssertionError` is replaced with a `ValueError`, but I think it maybe trivial to add it to migration-doc



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