Skip to content

Comments

[Improvement] Refactor getPartitionRange to calculate range directly#447

Merged
advancedxy merged 6 commits intoapache:masterfrom
a-li:partition-range-helper-refactor
Dec 28, 2022
Merged

[Improvement] Refactor getPartitionRange to calculate range directly#447
advancedxy merged 6 commits intoapache:masterfrom
a-li:partition-range-helper-refactor

Conversation

@a-li
Copy link
Contributor

@a-li a-li commented Dec 24, 2022

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?

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

…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-commenter
Copy link

codecov-commenter commented Dec 25, 2022

Codecov Report

Merging #447 (afa5678) into master (5321292) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@             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     
Impacted Files Coverage Δ
...ache/uniffle/storage/util/ShuffleStorageUtils.java 65.55% <100.00%> (+1.42%) ⬆️
.../apache/uniffle/common/ShufflePartitionedData.java 52.94% <0.00%> (-28.88%) ⬇️
...pache/uniffle/server/ShuffleServerGrpcService.java 0.80% <0.00%> (-0.01%) ⬇️
...he/uniffle/server/buffer/ShuffleBufferManager.java 82.75% <0.00%> (+0.01%) ⬆️
...a/org/apache/uniffle/server/ShuffleServerConf.java 99.27% <0.00%> (+0.03%) ⬆️
.../org/apache/uniffle/server/ShuffleTaskManager.java 75.88% <0.00%> (+1.22%) ⬆️
...pache/hadoop/mapreduce/task/reduce/RssFetcher.java 90.90% <0.00%> (+1.51%) ⬆️
...ategy/storage/AppBalanceSelectStorageStrategy.java 74.00% <0.00%> (+2.00%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@a-li a-li requested a review from advancedxy December 26, 2022 05:03
@advancedxy
Copy link
Contributor

LGTM, except one minor comment.

Copy link
Contributor

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

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

Thanks, I'm merge this.

@advancedxy advancedxy merged commit fa364c1 into apache:master Dec 28, 2022
@a-li a-li deleted the partition-range-helper-refactor branch December 28, 2022 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] refactor getPartitionRange to calculate range directly

4 participants