advancedxy commented on code in PR #447:
URL: https://github.com/apache/incubator-uniffle/pull/447#discussion_r1058015502
##########
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java:
##########
@@ -167,15 +167,13 @@ public static String getShuffleDataPathWithRange(
public static int[] getPartitionRange(int partitionId, int
partitionNumPerRange, int partitionNum) {
int[] range = null;
- int prNum = partitionNum % partitionNumPerRange == 0
- ? partitionNum / partitionNumPerRange : partitionNum /
partitionNumPerRange + 1;
- for (int i = 0; i < prNum; i++) {
- int start = i * partitionNumPerRange;
- int end = (i + 1) * partitionNumPerRange - 1;
- if (partitionId >= start && partitionId <= end) {
- range = new int[]{start, end};
- break;
- }
+ int prNum = (partitionId < partitionNumPerRange || partitionId %
partitionNumPerRange == 0)
+ ? partitionId / partitionNumPerRange : partitionId /
partitionNumPerRange;
Review Comment:
`? partitionId / partitionNumPerRange : partitionId / partitionNumPerRange;`
The ternary operator's last operants are the same? I think `prNum =
partitionId / partitionNumPerRange` should be suffice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]