Skip to content

Commit a2aa36b

Browse files
committed
RDD take method: overestimate too much
1 parent cf1d32e commit a2aa36b

File tree

1 file changed

+1
-2
lines changed
  • core/src/main/scala/org/apache/spark/rdd

1 file changed

+1
-2
lines changed

core/src/main/scala/org/apache/spark/rdd/RDD.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,10 +1084,9 @@ abstract class RDD[T: ClassTag](
10841084
if (buf.size == 0) {
10851085
numPartsToTry = partsScanned * 4
10861086
} else {
1087-
numPartsToTry = (1.5 * num * partsScanned / buf.size).toInt
1087+
numPartsToTry = (1.5 * num * partsScanned / buf.size).toInt - partsScanned
10881088
}
10891089
}
1090-
numPartsToTry = math.max(0, numPartsToTry) // guard against negative num of partitions
10911090

10921091
val left = num - buf.size
10931092
val p = partsScanned until math.min(partsScanned + numPartsToTry, totalParts)

0 commit comments

Comments
 (0)