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


##########
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:
   Change `assert` to ValueError is right definately, I believe all `assert` in 
main code (espacailly, use when validation params) should be fix (test mode is 
okay)
   
   [1] https://mail.python.org/pipermail/python-list/2013-November/810940.html
   



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