Repository navigation
fixing overflow in GatkSparkTool.getRecommendedNumReducers() - #5586
Merged
Merged
Conversation
Codecov Report
|
droazen
previously requested changes
Jan 17, 2019
| } | ||
| int size = readInputs.keySet().stream().mapToInt(k -> (int) BucketUtils.dirSize(k)).sum(); | ||
| return 1 + (size / getTargetPartitionSize()); | ||
| long size = readInputs.keySet().stream().mapToLong(k -> BucketUtils.dirSize(k)).sum(); |
Contributor
There was a problem hiding this comment.
Can you add an explicit check for overflow before downcasting the long?
jamesemery
approved these changes
Jan 17, 2019
| int size = readInputs.keySet().stream().mapToInt(k -> (int) BucketUtils.dirSize(k)).sum(); | ||
| return 1 + (size / getTargetPartitionSize()); | ||
| long size = readInputs.keySet().stream().mapToLong(k -> BucketUtils.dirSize(k)).sum(); | ||
| return 1 + Math.toIntExact(size / getTargetPartitionSize()); |
There was a problem hiding this comment.
If you are going to use a throwing method you should at least catch this exception and give a helpful error message, as some user/developer may want to increase the target partition size to compensate or some other such thing.
Contributor
Author
|
@droazen @jamesemery I've made changes, could someone take a look if you get a chance. |
jamesemery
approved these changes
Jan 22, 2019
jamesemery
left a comment
There was a problem hiding this comment.
Looks good to me now 👍 feel free to merge
lbergelson
dismissed
droazen’s stale review
January 22, 2019 19:10
responded to these comments and James did a re-review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.