We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad483fd commit a40e8fbCopy full SHA for a40e8fb
core/src/main/scala/org/apache/spark/rdd/RDD.scala
@@ -310,9 +310,8 @@ abstract class RDD[T: ClassTag](
310
* Return a sampled subset of this RDD.
311
*/
312
def sample(withReplacement: Boolean, fraction: Double, seed: Int): RDD[T] = {
313
- if (fraction < Double.MinValue || fraction > Double.MaxValue) {
314
- throw new Exception("Invalid fraction value:" + fraction)
315
- }
+ require(fraction >= 0 && fraction <= Double.MaxValue,
+ "Invalid fraction value: " + fraction)
316
if (withReplacement) {
317
new PartitionwiseSampledRDD[T, T](this, new PoissonSampler[T](fraction), seed)
318
} else {
0 commit comments