Skip to content
Closed
Changes from 2 commits
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
14 changes: 7 additions & 7 deletions core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1298,18 +1298,18 @@ class SizeBasedCoalescer(val maxSize: Int) extends PartitionCoalescer with Seria
val splitSize = fileSplit.getLength
if (currentSum + splitSize < maxSize) {
addPartition(partition, splitSize)
index += 1
if (index == partitions.size) {
updateGroups
}
} else {
if (currentGroup.partitions.size == 0) {
if (currentGroup.partitions.isEmpty) {
addPartition(partition, splitSize)
index += 1
} else {
updateGroups

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you point out which line/lines cause the bug?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

can you point out which line/lines cause the bug?

In the pr description I have show the case this bug happen. Not one line or some lines cause this error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

can you point out which line/lines cause the bug?

Change the desc make it more clear.

updateGroups()
addPartition(partition, splitSize)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of the following,

if (currentGroup.partitions.isEmpty) {
  addPartition(partition, splitSize)
} else {
  updateGroups()
  addPartition(partition, splitSize)
}

The following will be better.

if (currentGroup.partitions.nonEmpty) {
  updateGroups()
}
addPartition(partition, splitSize)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks

}
index += 1
if (index == partitions.length) {
updateGroups()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: can we do this after the loop exit? There is no early stop in this loop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nit: can we do this after the loop exit? There is no early stop in this loop.

Sure, updated, since before exit loop, the last action is addPartition so currentGourps if not empty, we don't need to check if currentGroup is empty, just updateGroups

}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

BTW, the previous code was added at 2.0.0. Did you hit a test flakiness due to this?

@AngersZhuuuu AngersZhuuuu Apr 2, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

BTW, the previous code was added at 2.0.0. Did you hit a test flakiness due to this?

Yeah, these days I am testing a way to fix spark small out put file problem, and I use this logic, during test, found that this logic is wrong.
#27248

}
groups.toArray
}
Expand Down