Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update RDD.scala
  • Loading branch information
vinodkc committed Sep 15, 2015
commit 7fa497d22debec6c8c951cd8ed66961e95ae8801
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/rdd/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ abstract class RDD[T: ClassTag](
s"$numStDev * math.sqrt(Int.MaxValue)")

val initialCount = this.count()
if (num == 0 || initialCount == 0 ) {
if (num == 0 || initialCount == 0) {
new Array[T](0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, the only difference here is that if num == 0 we still do a count(), whereas before we just return quickly. I think we should preserve the old behavior even though it adds another layer of nesting and unfortunately makes the code harder to read.

} else {
val rand = new Random(seed)
Expand Down