-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-31226][CORE][TESTS] SizeBasedCoalesce logic will lose partition #27988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| updateGroups() | ||
| addPartition(partition, splitSize) | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated, thanks |
||
| } | ||
| index += 1 | ||
| if (index == partitions.length) { | ||
| updateGroups() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sure, updated, since before exit loop, the last action is |
||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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. |
||
| } | ||
| groups.toArray | ||
| } | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the pr description I have show the case this bug happen. Not one line or some lines cause this error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the desc make it more clear.