[Improvement] Refactor getPartitionRange to calculate range directly#447
Merged
advancedxy merged 6 commits intoapache:masterfrom Dec 28, 2022
Merged
Conversation
…pache#443) ### What changes were proposed in this pull request? 1. Refactor ShuffleStorageUtils.getPartitionRange to calculate range directly. 2. The runtime of the function will be O(1) as opposed to O(n) in the original implementation. ### Why are the changes needed? The current implementation of ShuffleStorageUtils.getPartitionRange is O(n) which is not performant and can be done in O(1) by directly computing it using the partionId. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? 1. existing UTs + new UTs
Codecov Report
@@ Coverage Diff @@
## master #447 +/- ##
============================================
+ Coverage 58.62% 58.72% +0.09%
- Complexity 1642 1652 +10
============================================
Files 199 199
Lines 11173 11212 +39
Branches 989 996 +7
============================================
+ Hits 6550 6584 +34
- Misses 4231 4237 +6
+ Partials 392 391 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
advancedxy
reviewed
Dec 26, 2022
storage/src/test/java/org/apache/uniffle/storage/util/ShuffleStorageUtilsTest.java
Show resolved
Hide resolved
advancedxy
reviewed
Dec 27, 2022
storage/src/test/java/org/apache/uniffle/storage/util/ShuffleStorageUtilsTest.java
Outdated
Show resolved
Hide resolved
advancedxy
reviewed
Dec 27, 2022
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java
Show resolved
Hide resolved
advancedxy
reviewed
Dec 28, 2022
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java
Outdated
Show resolved
Hide resolved
Contributor
|
LGTM, except one minor comment. |
advancedxy
approved these changes
Dec 28, 2022
Contributor
advancedxy
left a comment
There was a problem hiding this comment.
Thanks, I'm merge this.
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.
What changes were proposed in this pull request?
Why are the changes needed?
fix #443
The current implementation of ShuffleStorageUtils.getPartitionRange is O(n) which is not performant and can be done in O(1) by directly computing it using the partionId.
Does this PR introduce any user-facing change?
No
How was this patch tested?
existing UTs + new UTs